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 .segment_values_get_response import SegmentValuesGetResponse

class SegmentValuesRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /cost/v1/containers/{containerId}/segment-values
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new SegmentValuesRequestBuilder 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}/segment-values{?cursorState*,filter%5Bcode%5D*,filter%5Bid%5D*,filter%5BlastModifiedSince%5D*,filter%5BoriginalCode%5D*,filter%5BparentId%5D*,filter%5BsegmentId%5D*,limit*,sort*}", path_parameters)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[SegmentValuesRequestBuilderGetQueryParameters]] = None) -> Optional[SegmentValuesGetResponse]:
        """
        Retrieves the defined segment values for the specified budget code segment.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[SegmentValuesGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .segment_values_get_response import SegmentValuesGetResponse

        return await self.request_adapter.send_async(request_info, SegmentValuesGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[SegmentValuesRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Retrieves the defined segment values for the specified budget code segment.
        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) -> SegmentValuesRequestBuilder:
        """
        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: SegmentValuesRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return SegmentValuesRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class SegmentValuesRequestBuilderGetQueryParameters():
        """
        Retrieves the defined segment values for the specified budget code segment.
        """
        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 == "filtercode":
                return "filter%5Bcode%5D"
            if original_name == "filterid":
                return "filter%5Bid%5D"
            if original_name == "filterlast_modified_since":
                return "filter%5BlastModifiedSince%5D"
            if original_name == "filteroriginal_code":
                return "filter%5BoriginalCode%5D"
            if original_name == "filterparent_id":
                return "filter%5BparentId%5D"
            if original_name == "filtersegment_id":
                return "filter%5BsegmentId%5D"
            if original_name == "limit":
                return "limit"
            if original_name == "sort":
                return "sort"
            return original_name
        
        # A cursor token used for paginating results.This value is returned in the response when additional pages of data are available. Pass the returned `cursorState` into a subsequent request to retrieve the next page of results.The cursor token is an opaque string. Do not modify or parse its contents.
        cursor_state: Optional[str] = None

        # Returns only items that are identified by the specified codes (separated by commas). For example, ``filter[code]=``2703,2704````.Note that even single codes in number format must be enclosed in double quotes:``filter[code]=``1```` or ``filter[code]=``122. 221````.
        filtercode: Optional[list[str]] = None

        # Returns only the items that are identified by the provided list of item IDs. Separate multiple IDs with commas. For example, ``filter[id]=id1,id2``.
        filterid: Optional[list[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 the values of segments with the specified original codes, including delimiters. For example, ``filter[originalCode]=27-03,27-04``.
        filteroriginal_code: Optional[list[str]] = None

        # Returns only the values of segments with the specified IDs of parent segments. Separate multiple parent IDs with commas. For example, ``filter[parentId]=parentId1,parentId2``. You can also return the values of segments that have no parent by including ``filter[parentId]=blank``.
        filterparent_id: Optional[list[str]] = None

        # The budget code segment ID. Separate multiple IDs with commas. For example, ``filter[segmentId]=id1,id2``.
        filtersegment_id: Optional[list[str]] = None

        # The maximum number of records returned per page. Default: ``100``. A page may contain fewer records than the limit if there are fewer matching items or if it is the last page of results.
        limit: Optional[int] = None

        # Defines the sort order for the results. Each attribute can be sorted in ``asc`` (default) or ``desc`` order. For example, ``sort=name desc`` sorts the results by name in descending order.
        sort: Optional[str] = None

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

