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 .sheets_get_response import SheetsGetResponse

class SheetsRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /construction/sheets/v1/projects/{projectId}/sheets
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new SheetsRequestBuilder 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}/sheets{?collectionId*,currentOnly*,fields*,filter%5Btags%5D*,filter%5BversionSetId%5D*,isDeleted*,limit*,offset*,searchText*,withAllTags*}", path_parameters)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[SheetsRequestBuilderGetQueryParameters]] = None) -> Optional[SheetsGetResponse]:
        """
        Retrieves information about the sheets in a project.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[SheetsGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .sheets_get_response import SheetsGetResponse

        return await self.request_adapter.send_async(request_info, SheetsGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[SheetsRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Retrieves information about the sheets in a 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 with_url(self,raw_url: str) -> SheetsRequestBuilder:
        """
        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: SheetsRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return SheetsRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class SheetsRequestBuilderGetQueryParameters():
        """
        Retrieves information about the sheets in a project.
        """
        def get_query_parameter(self,original_name: str) -> str:
            """
            Maps the query parameters names to their encoded names for the URI template parsing.
            param original_name: The original query parameter name in the class.
            Returns: str
            """
            if original_name is None:
                raise TypeError("original_name cannot be null.")
            if original_name == "collection_id":
                return "collectionId"
            if original_name == "current_only":
                return "currentOnly"
            if original_name == "filtertags":
                return "filter%5Btags%5D"
            if original_name == "filterversion_set_id":
                return "filter%5BversionSetId%5D"
            if original_name == "is_deleted":
                return "isDeleted"
            if original_name == "search_text":
                return "searchText"
            if original_name == "with_all_tags":
                return "withAllTags"
            if original_name == "fields":
                return "fields"
            if original_name == "limit":
                return "limit"
            if original_name == "offset":
                return "offset"
            return original_name
        
        # Filter by sheet collection. If not provided, only results in the ungrouped collection are returned.Possible values:- The UUID of an existing collection: Returns only the results within that collection.- ``*`` Returns results from all collections.
        collection_id: Optional[str] = None

        # - ``true`` to only return versions of the sheets with the newest issuance date (this includes future issuance dates). This is only relevant if you uploaded multiple versions of the same sheet that were assigned the same number identifier. If you do not assign a value to the version set ID filter (``filter[versionSetId]``) this defaults to ``true``.- ``false`` to return all sheets in the project.If you specify a value for the version set ID filter (``filter[versionSetId]``) this defaults to ``false``.If you do not specify a version set, the default is ``true``.
        current_only: Optional[bool] = None

        # Specify which attributes you want to appear in the response. You can specify multiple attributes.For example, to only return the sheet ID and sheet number in the response, use ``fields=id&fields=number``.
        fields: Optional[str] = None

        # Filter sheets by tags. You can filter by multiple tags. For example,``filter[tags]=architecture&filter[tags]=structure`` returns sheets that include both ``architecture`` and ``structure`` tags.Use ``filter[tags]=__UNTAGGED`` to only return sheets without any tags.
        filtertags: Optional[str] = None

        # Filter sheets by the version set ID. If you assign a value to this filter, ``currentOnly`` defaults to ``false``. If you do not assign a value, ``currentOnly`` default to ``true``.
        filterversion_set_id: Optional[str] = None

        # - ``true`` to only return deleted sheets.- ``false`` to only return non-deleted sheets.The default value is ``false``. You cannot retrieve both deleted and non-deleted sheets in one call.
        is_deleted: Optional[bool] = None

        # The number of results to return in the response. Acceptable values: ``1``-``100``. Default value: ``100``.
        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

        # Search for sheets with the specified text. The API only searches in the ``number`` and ``title`` attributes.You can specify a string or part of a string. The search is case sensitive.You can only use one search string per call. For example, ``searchText=kitchen``.
        search_text: Optional[str] = None

        # - ``true`` to return sheets that contain all search tags.- ``false`` to return sheets that contain at least one tag.If ``filter[tags]=__UNTAGGED`` is already in query parameters, ``withAllTags`` does not work.
        with_all_tags: Optional[bool] = None

    
    @dataclass
    class SheetsRequestBuilderGetRequestConfiguration(RequestConfiguration[SheetsRequestBuilderGetQueryParameters]):
        """
        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)
    

