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 .assets_get_response import AssetsGetResponse

class AssetsRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /construction/assets/v2/projects/{projectId}/assets
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new AssetsRequestBuilder 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/assets/v2/projects/{projectId}/assets{?cursorState*,filter%5BcategoryId%5D*,filter%5BcustomAttributes%5D*,filter%5BlocationId%5D*,filter%5BsearchText%5D*,filter%5BstatusId%5D*,filter%5BstatusLabel%5D*,filter%5BupdatedAt%5D*,includeCustomAttributes*,includeDeleted*,includeSubLocations*,limit*,sort*}", path_parameters)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[AssetsRequestBuilderGetQueryParameters]] = None) -> Optional[AssetsGetResponse]:
        """
        GET assets V2
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[AssetsGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .assets_get_response import AssetsGetResponse

        return await self.request_adapter.send_async(request_info, AssetsGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[AssetsRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        GET assets V2
        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) -> AssetsRequestBuilder:
        """
        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: AssetsRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return AssetsRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class AssetsRequestBuilderGetQueryParameters():
        """
        GET assets V2
        """
        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 == "cursor_state":
                return "cursorState"
            if original_name == "filtercategory_id":
                return "filter%5BcategoryId%5D"
            if original_name == "filtercustom_attributes":
                return "filter%5BcustomAttributes%5D"
            if original_name == "filterlocation_id":
                return "filter%5BlocationId%5D"
            if original_name == "filtersearch_text":
                return "filter%5BsearchText%5D"
            if original_name == "filterstatus_id":
                return "filter%5BstatusId%5D"
            if original_name == "filterstatus_label":
                return "filter%5BstatusLabel%5D"
            if original_name == "filterupdated_at":
                return "filter%5BupdatedAt%5D"
            if original_name == "include_custom_attributes":
                return "includeCustomAttributes"
            if original_name == "include_deleted":
                return "includeDeleted"
            if original_name == "include_sub_locations":
                return "includeSubLocations"
            if original_name == "limit":
                return "limit"
            if original_name == "sort":
                return "sort"
            return original_name
        
        # An opaque cursor token that identifies where the next page of paginated results should start. It's returned ineach paginated response so that it can be supplied in the next request to continue paginated results. If apaginated response contains no ``cursorState`` value, then there are no further pages to return.Omit this field to initiate a paginated request or to restart pagination.
        cursor_state: Optional[str] = None

        # An exploded array of category IDs to which all returned objects must belong. For example,``?filter[categoryId]=123&filter[categoryId]=456``.
        filtercategory_id: Optional[list[str]] = None

        # A custom attribute and value that each returned object must have. This filter is keyed by the custom attribute'sname field and set equal to the desired value. As an example, ``?filter[customAttributes][ca1]=true``. Use thisfield multiple times to specify more than one custom attribute filter.The value supplied for a custom attribute filter must match the type specified by the attribute. Values can be:- A single value, or exploded array of values, of string, boolean, or number (for ``text``, ``numeric``, ``date``, ``boolean``, ``select``, or ``multi_select`` types). Note that a string value for a ``text`` data type will perform a case-insensitive, substring match.- A range of values (inclusive) in the form: ``startValue..endValue`` (for ``numeric`` or ``date`` Types).- Partial ranges (inclusive): ``...endValue`` or ``startValue..`` (for ``numeric`` or ``date`` Types).Select and Multi-Select filters should use Custom Attribute Value IDs as values.Note that explicit value filters and range filters for a given attribute cannot be used in conjunction.Examples (without URL escaping)Example 1) Filter a ``boolean`` custom attribute:``?filter[customAttributes][ca1]=true``Example 2) Filter a ``numeric`` range custom attribute:``?filter[customAttributes][ca2]=1..5``Example 3) Filter a ``date`` custom attribute to on or before a given date:``?filter[customAttributes][ca3]=..2020-11-01``Example 4) Filter a ``select`` custom attribute:``?filter[customAttributes][ca4]=b959daad-4d00-4209-9acc-e900ac5832cf``Example 5) Filter a ``multi_select`` custom attribute to multiple values:``?filter[customAttributes][ca5]=63801bb7-db1f-49bf-9000-a392a5879f22&filter[customAttributes][ca5]=757d0934-a4a0-4af8-821d-64d611e84a56``Example 6) Filter a ``text`` custom attribute to a given input:``?filter[customAttributes][ca6]=Some text input``
        filtercustom_attributes: Optional[str] = None

        # An exploded array of location IDs. Each returned object must be associated with one of the locations specifiedby the IDs. To specify sub-locations of a location, provide a single location ID here and then set the``includeSubLocations`` field in the request to ``true``. For example,``?filter[locationId]=826e102a-36de-41e7-8c58-1b1696ccbba8&filter[locationId]=cee49807-fcc4-43ae-80a2-8ca819dfa70d``.
        filterlocation_id: Optional[list[str]] = None

        # A string that must be contained within any of a returned object's searchable text fields, including text customattributes. ``searchText`` is case-insensitive, and will match substrings as well as full strings.
        filtersearch_text: Optional[str] = None

        # An exploded array of status IDs. Each returned object must have one of the statuses specified by the IDs. Forexample, ``?filter[statusId]=84eb6a10-dde3-475f-aaf4-b5df3aebbd0b&filter[statusId]=5ba5c1af-fcd6-4506-b5e4-f20f5321dd69``.
        filterstatus_id: Optional[list[str]] = None

        # An exploded array of status labels. Each returned object must have one of the statuses bearing any of theselabels, case-insensitive. For example, ``?filter[statusLabel]=ordered&filter[statusLabel]=delivered``.
        filterstatus_label: Optional[list[str]] = None

        # A string that specifies a date and time or a date and time range at which all returned objects mast have beenupdated. A single date and time takes this format: ``YYYY-MM-DDThh:mm:ss.SSSZ``, A date and time range takes thisformat: ``YYYY-MM-DDThh:mm:ss.SSSZ..YYYY-MM-DDThh:mm:ss.SSSZ``. Range queries can be closed or open in eitherdirection: ``YYYY-MM-DDThh:mm:ss.SSSZ..`` or ``..YYYY-MM-DDThh:mm:ss.SSSZ``.
        filterupdated_at: Optional[str] = None

        # Specifies whether or not returned assets include custom attributes or not. If ``true``, they're included. If``false``, they're not. Default is ``false``.
        include_custom_attributes: Optional[bool] = None

        # Whether or not soft-deleted object should be included in the response. If ``true``, soft-deleted objects are returned. If ``false``, they are not. The default is ``false``.
        include_deleted: Optional[bool] = None

        # Specifies whether or not to consider sub-locations when filtering by ``locationId``. For this setting to work,the request must contain only a single for ``filter[locationId]``. If ``true``, the search looks for assets withinthe specified location and in all the sub-locations of the specified location. If ``false``, the search looks forassets only within the specified location(s). Default is ``false``.
        include_sub_locations: Optional[bool] = None

        # The maximum number of objects that can be returned in a page. A request might return fewer objects than the limit if the Assets service runs out of specified objects to return - at the end of a set of paged results, for example. The maximum limit is ``200``; the default limit is ``25``.
        limit: Optional[int] = None

        # A string that specifies how to sort returned objects. The string provides a valid API field name with anoptional direction, either ``asc`` (ascending) or ``desc`` (descending). In the case of custom attributes, use dotnotation to specify the attribute by name—for example, ``customAttributes.ca3 desc``. The string may containmultiple comma-separated expressions for secondary sorts. The default sort order is ``asc`` if not provided.
        sort: Optional[str] = None

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

