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 .linked_files_get_response import LinkedFilesGetResponse

class LinkedFilesRequestBuilder(BaseRequestBuilder):
    """
    Builds and executes requests for operations under /construction/rcm/v1/projects/{projectId}/published-versions/{versionId}/linked-files
    """
    def __init__(self,request_adapter: RequestAdapter, path_parameters: Union[str, dict[str, Any]]) -> None:
        """
        Instantiates a new LinkedFilesRequestBuilder 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/rcm/v1/projects/{projectId}/published-versions/{versionId}/linked-files{?filter*,includeHost*,limit*,offset*}", path_parameters)
    
    async def get(self,request_configuration: Optional[RequestConfiguration[LinkedFilesRequestBuilderGetQueryParameters]] = None) -> Optional[LinkedFilesGetResponse]:
        """
        Retrieves metadata and signed download URLs for a published version of a Revit (RVT) cloud model, whether workshared or non-workshared, and any Revit files linked to it.
        param request_configuration: Configuration for the request such as headers, query parameters, and middleware options.
        Returns: Optional[LinkedFilesGetResponse]
        """
        request_info = self.to_get_request_information(
            request_configuration
        )
        if not self.request_adapter:
            raise Exception("Http core is null") 
        from .linked_files_get_response import LinkedFilesGetResponse

        return await self.request_adapter.send_async(request_info, LinkedFilesGetResponse, None)
    
    def to_get_request_information(self,request_configuration: Optional[RequestConfiguration[LinkedFilesRequestBuilderGetQueryParameters]] = None) -> RequestInformation:
        """
        Retrieves metadata and signed download URLs for a published version of a Revit (RVT) cloud model, whether workshared or non-workshared, and any Revit files linked to it.
        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) -> LinkedFilesRequestBuilder:
        """
        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: LinkedFilesRequestBuilder
        """
        if raw_url is None:
            raise TypeError("raw_url cannot be null.")
        return LinkedFilesRequestBuilder(self.request_adapter, raw_url)
    
    @dataclass
    class LinkedFilesRequestBuilderGetQueryParameters():
        """
        Retrieves metadata and signed download URLs for a published version of a Revit (RVT) cloud model, whether workshared or non-workshared, and any Revit files linked to it.
        """
        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 == "include_host":
                return "includeHost"
            if original_name == "filter":
                return "filter"
            if original_name == "limit":
                return "limit"
            if original_name == "offset":
                return "offset"
            return original_name
        
        # Specifies criteria for filtering the linked files by name or publish status.- Filter by file name:- Example: ``filter[name]=StructuralModel_2023.rvt&filter[name]=ArchitecturalModel_2023.rvt``- Filter by publish status:- Published files: ``filter[publishStatus]=published``- Unpublished files: ``filter[publishStatus]=notPublished``- Both published and unpublished: ``filter[publishStatus]=published,notPublished``
        filter: Optional[str] = None

        # Indicates whether to include the signed URL for the host model in the response.``true`` (default): the host model’s signed URL is included.``false``: only includes the signed URLs of the linked files.
        include_host: Optional[bool] = None

        # The maximum number of linked models to return in a single request. Maxium: ``600``. Default: ``600``.
        limit: Optional[int] = None

        # The index at which the endpoint starts returning results. Used for pagination. Default: ``0``.This is a zero-based index (if set to ``100``, results start from the 101st entry).
        offset: Optional[int] = None

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

