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 .properties_get_response import PropertiesGetResponse

class PropertiesRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /cost/v1/containers/{containerId}/properties
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new PropertiesRequestBuilder 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}/cost/v1/containers/{containerId}/properties{?filter%5BassociationId%5D*,filter%5BassociationType%5D*,filter%5BlastModifiedSince%5D*,filter%5Bname%5D*}", path_parameters)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[PropertiesRequestBuilderGetQueryParameters]] = None) -> Optional[PropertiesGetResponse]:
        """
        Lists all the attribute definitions created to define custom attributes for a given module.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[PropertiesGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .properties_get_response import PropertiesGetResponse

        return await self.request_adapter.send_async(request_info, PropertiesGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[PropertiesRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Lists all the attribute definitions created to define custom attributes for a given module.
        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) -> PropertiesRequestBuilder:
        """
        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: PropertiesRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return PropertiesRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class PropertiesRequestBuilderGetQueryParameters():
        """
        Lists all the attribute definitions created to define custom attributes for a given module.
        """
        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 == "filterassociation_id":
                return "filter%5BassociationId%5D"
            if original_name == "filterassociation_type":
                return "filter%5BassociationType%5D"
            if original_name == "filterlast_modified_since":
                return "filter%5BlastModifiedSince%5D"
            if original_name == "filtername":
                return "filter%5Bname%5D"
            return original_name
        
        # The ID of the associated item, for example, the ID of a budget, contract, change order or cost item.Separate multiple IDs with commas, for example, ``filter[associationId]=id1,id2``.
        filterassociation_id: Optional[list[str]] = None

        # The type of the associated item.Possible values: ``Budget``, ``Contract``, ``CostItem``, ``FormDefinition``, ``Payment``, ``BudgetPayment``, ``Expense``, ``ExpenseItem``.For example, ``filter[associationType]=Budget``.
        filterassociation_type: Optional[str] = None

        # Returns only items that were modified since the specified date and time, in ISO 8601 format. For example, ``filter[lastModifiedSince]=2020-03-01T13:00:00Z``.
        filterlast_modified_since: Optional[str] = None

        # Returns only items with the specified name. For example, ``filter[name]=Labor``.Max length: 255
        filtername: Optional[str] = None

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

