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.responses_item_request_builder import ResponsesItemRequestBuilder
    from .responses_get_response import ResponsesGetResponse

class ResponsesRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /construction/submittals/v2/projects/{projectId}/responses
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new ResponsesRequestBuilder 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/submittals/v2/projects/{projectId}/responses{?limit*,offset*}", path_parameters)
    
    def by_id(self,id: str) -> ResponsesItemRequestBuilder:
        """
        Gets an item from the Autodesk.ACC.construction.submittals.v2.projects.item.responses.item collection
        param id: The ID of the submittal item to retrieve revisions for. To obtain this ID, call `GET items </en/docs/acc/v1/reference/http/submittals-items-GET/>`_.
        Returns: ResponsesItemRequestBuilder
        """
        if id is None:
            raise TypeError("id cannot be null.")
        from .item.responses_item_request_builder import ResponsesItemRequestBuilder

        url_tpl_params = get_path_parameters(self.path_parameters)
        url_tpl_params["id"] = id
        return ResponsesItemRequestBuilder(self.request_adapter, url_tpl_params)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[ResponsesRequestBuilderGetQueryParameters]] = None) -> Optional[ResponsesGetResponse]:
        """
        Retrieves all the responses for the specified project.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[ResponsesGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .responses_get_response import ResponsesGetResponse

        return await self.request_adapter.send_async(request_info, ResponsesGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[ResponsesRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Retrieves all the responses for the specified 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) -> ResponsesRequestBuilder:
        """
        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: ResponsesRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return ResponsesRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class ResponsesRequestBuilderGetQueryParameters():
        """
        Retrieves all the responses for the specified project.
        """
        # The maximum number of results per page. Possible values: ``1``- ``50``. Default value: ``20``. For example, to limit the response to two results per page, use ``limit=2``.
        limit: Optional[int] = None

        # The number of results to skip before starting to return data. For example, to skip the first 20 results, include ``offset=20`` in the query string. For more details, see the `JSON API Paging Help documentation <https://jsonapi.org/format/#fetching-pagination>`_.
        offset: Optional[int] = None

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

