from __future__ import annotations
from collections.abc import Callable
from dataclasses import dataclass, field
from kiota_abstractions.base_request_builder import BaseRequestBuilder
from kiota_abstractions.base_request_configuration import RequestConfiguration
from kiota_abstractions.default_query_parameters import QueryParameters
from kiota_abstractions.get_path_parameters import get_path_parameters
from kiota_abstractions.method import Method
from kiota_abstractions.request_adapter import RequestAdapter
from kiota_abstractions.request_information import RequestInformation
from kiota_abstractions.request_option import RequestOption
from kiota_abstractions.serialization import Parsable, ParsableFactory
from typing import Any, Optional, TYPE_CHECKING, Union
from warnings import warn

if TYPE_CHECKING:
    from .item.with_upload_item_request_builder import WithUploadItemRequestBuilder
    from .uploads_get_response import UploadsGetResponse
    from .uploads_post_request_body import UploadsPostRequestBody
    from .uploads_post_response import UploadsPostResponse

class UploadsRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /construction/sheets/v1/projects/{projectId}/uploads
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new UploadsRequestBuilder and sets the default values.
        param path_parameters: The raw url or the url-template parameters for the request.
        param request_adapter: The request adapter to use to execute the requests.
        Returns: None
        """
        super().__init__(request_adapter, "{+baseurl}/construction/sheets/v1/projects/{projectId}/uploads{?limit*,offset*,sort*}", path_parameters)
    
    def by_upload_id(self,upload_id: str) -> WithUploadItemRequestBuilder:
        """
        Gets an item from the Autodesk.ACC.construction.sheets.v1.projects.item.uploads.item collection
        param upload_id: The ID of the upload. The upload ID is generated when you `create an upload object </en/docs/acc/v1/reference/http/sheets-uploads-POST/>`_.
        Returns: WithUploadItemRequestBuilder
        """
        if upload_id is None:
            raise TypeError("upload_id cannot be null.")
        from .item.with_upload_item_request_builder import WithUploadItemRequestBuilder

        url_tpl_params = get_path_parameters(self.path_parameters)
        url_tpl_params["uploadId"] = upload_id
        return WithUploadItemRequestBuilder(self.request_adapter, url_tpl_params)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[UploadsRequestBuilderGetQueryParameters]] = None) -> Optional[UploadsGetResponse]:
        """
        Checks the processing status of all the uploaded files in the project.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[UploadsGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .uploads_get_response import UploadsGetResponse

        return await self.request_adapter.send_async(request_info, UploadsGetResponse, None)
    
    async def post(self,body: UploadsPostRequestBody, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> Optional[UploadsPostResponse]:
        """
        Creates an ACC upload object. This endpoint splits the files into separate sheets.
        param body: The request body
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[UploadsPostResponse]
        """
        if body is None:
            raise TypeError("body cannot be null.")
        request_info = self.to_post_request_information(
            body, request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .uploads_post_response import UploadsPostResponse

        return await self.request_adapter.send_async(request_info, UploadsPostResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[UploadsRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Checks the processing status of all the uploaded files in the project.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: RequestInformation
        """
        request_info = RequestInformation(Method.GET, self.url_template, self.path_parameters)
        request_info.configure(request_configuration)
        request_info.headers.try_add("Accept", "application/json")
        return request_info
    
    def to_post_request_information(self,body: UploadsPostRequestBody, request_configuration: Optional[RequestConfiguration[QueryParameters]] = None) -> RequestInformation:
        """
        Creates an ACC upload object. This endpoint splits the files into separate sheets.
        param body: The request body
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: RequestInformation
        """
        if body is None:
            raise TypeError("body cannot be null.")
        request_info = RequestInformation(Method.POST, self.url_template, self.path_parameters)
        request_info.configure(request_configuration)
        request_info.headers.try_add("Accept", "application/json")
        request_info.set_content_from_parsable(self.request_adapter, "application/json", body)
        return request_info
    
    def with_url(self,raw_url: str) -> UploadsRequestBuilder:
        """
        Returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored.
        param raw_url: The raw URL to use for the request builder.
        Returns: UploadsRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return UploadsRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class UploadsRequestBuilderGetQueryParameters():
        """
        Checks the processing status of all the uploaded files in the project.
        """
        # The number of results to return in the response.
        limit: Optional[int] = None

        # The starting point for the results, specified by item number. The default value is ``0``. For example, use ``offset=3`` to start the results from the third item.
        offset: Optional[int] = None

        # Sort the uploads by ``createdAt`` or ``issuanceDate``. You need to add whether to sort in ascending (``asc``) or descending (``desc``) order. For example, ``sort=issuanceDate desc``.
        sort: Optional[str] = None

    
    @dataclass
    class UploadsRequestBuilderGetRequestConfiguration(RequestConfiguration[UploadsRequestBuilderGetQueryParameters]):
        """
        Configuration for the request such as headers, query parameters, and middleware options.
        """
        warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning)
    
    @dataclass
    class UploadsRequestBuilderPostRequestConfiguration(RequestConfiguration[QueryParameters]):
        """
        Configuration for the request such as headers, query parameters, and middleware options.
        """
        warn("This class is deprecated. Please use the generic RequestConfiguration class generated by the generator.", DeprecationWarning)
    

