# coding: utf-8

"""
    OneLive VGST API

    No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

    The version of the OpenAPI document: 0.1.3
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""  # noqa: E501

import warnings
from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
from typing import Any, Dict, List, Optional, Tuple, Union
from typing_extensions import Annotated

from datetime import datetime
from pydantic import Field, StrictInt, StrictStr
from typing import List, Optional
from typing_extensions import Annotated
from onelive_vgst.models.data_response_list_match_broadcast_full_read import DataResponseListMatchBroadcastFullRead
from onelive_vgst.models.paginated_response_match_read import PaginatedResponseMatchRead

from onelive_vgst.api_client import ApiClient, RequestSerialized
from onelive_vgst.api_response import ApiResponse
from onelive_vgst.rest import RESTResponseType


class MatchesApi:
    """NOTE: This class is auto generated by OpenAPI Generator
    Ref: https://openapi-generator.tech

    Do not edit the class manually.
    """

    def __init__(self, api_client=None) -> None:
        if api_client is None:
            api_client = ApiClient.get_default()
        self.api_client = api_client


    @validate_call
    async def get_match_broadcasts_v1_matches_broadcasts_get(
        self,
        broadcast_ids: Annotated[Optional[List[Optional[StrictInt]]], Field(description="List of broadcast ids (repeat query param)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> DataResponseListMatchBroadcastFullRead:
        """Get match broadcasts

        Returns broadcasts by ids and logs the access. Requires a customer JWT or API key.

        :param broadcast_ids: List of broadcast ids (repeat query param)
        :type broadcast_ids: List[Optional[int]]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_match_broadcasts_v1_matches_broadcasts_get_serialize(
            broadcast_ids=broadcast_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DataResponseListMatchBroadcastFullRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_match_broadcasts_v1_matches_broadcasts_get_with_http_info(
        self,
        broadcast_ids: Annotated[Optional[List[Optional[StrictInt]]], Field(description="List of broadcast ids (repeat query param)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[DataResponseListMatchBroadcastFullRead]:
        """Get match broadcasts

        Returns broadcasts by ids and logs the access. Requires a customer JWT or API key.

        :param broadcast_ids: List of broadcast ids (repeat query param)
        :type broadcast_ids: List[Optional[int]]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_match_broadcasts_v1_matches_broadcasts_get_serialize(
            broadcast_ids=broadcast_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DataResponseListMatchBroadcastFullRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_match_broadcasts_v1_matches_broadcasts_get_without_preload_content(
        self,
        broadcast_ids: Annotated[Optional[List[Optional[StrictInt]]], Field(description="List of broadcast ids (repeat query param)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get match broadcasts

        Returns broadcasts by ids and logs the access. Requires a customer JWT or API key.

        :param broadcast_ids: List of broadcast ids (repeat query param)
        :type broadcast_ids: List[Optional[int]]
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_match_broadcasts_v1_matches_broadcasts_get_serialize(
            broadcast_ids=broadcast_ids,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "DataResponseListMatchBroadcastFullRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_match_broadcasts_v1_matches_broadcasts_get_serialize(
        self,
        broadcast_ids,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'broadcast_ids': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if broadcast_ids is not None:
            
            _query_params.append(('broadcast_ids', broadcast_ids))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/matches/broadcasts',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )




    @validate_call
    async def get_matches_v1_matches_get(
        self,
        sport_id: Annotated[Optional[StrictInt], Field(description="Filter by sport id")] = None,
        sport_name: Annotated[Optional[StrictStr], Field(description="Filter by sport name")] = None,
        tournament: Annotated[Optional[StrictStr], Field(description="Filter by tournament")] = None,
        teams: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Filter by 1-2 team names (repeated query param)")] = None,
        start_at_from: Annotated[Optional[datetime], Field(description="Filter by start time from (inclusive)")] = None,
        start_at_to: Annotated[Optional[datetime], Field(description="Filter by start time to (inclusive)")] = None,
        page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> PaginatedResponseMatchRead:
        """Get matches

        Returns matches with sport info and broadcasts. Supports filters and page-based pagination (100 items per page).

        :param sport_id: Filter by sport id
        :type sport_id: int
        :param sport_name: Filter by sport name
        :type sport_name: str
        :param tournament: Filter by tournament
        :type tournament: str
        :param teams: Filter by 1-2 team names (repeated query param)
        :type teams: List[Optional[str]]
        :param start_at_from: Filter by start time from (inclusive)
        :type start_at_from: datetime
        :param start_at_to: Filter by start time to (inclusive)
        :type start_at_to: datetime
        :param page: Page number (1-based)
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_matches_v1_matches_get_serialize(
            sport_id=sport_id,
            sport_name=sport_name,
            tournament=tournament,
            teams=teams,
            start_at_from=start_at_from,
            start_at_to=start_at_to,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginatedResponseMatchRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        ).data


    @validate_call
    async def get_matches_v1_matches_get_with_http_info(
        self,
        sport_id: Annotated[Optional[StrictInt], Field(description="Filter by sport id")] = None,
        sport_name: Annotated[Optional[StrictStr], Field(description="Filter by sport name")] = None,
        tournament: Annotated[Optional[StrictStr], Field(description="Filter by tournament")] = None,
        teams: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Filter by 1-2 team names (repeated query param)")] = None,
        start_at_from: Annotated[Optional[datetime], Field(description="Filter by start time from (inclusive)")] = None,
        start_at_to: Annotated[Optional[datetime], Field(description="Filter by start time to (inclusive)")] = None,
        page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> ApiResponse[PaginatedResponseMatchRead]:
        """Get matches

        Returns matches with sport info and broadcasts. Supports filters and page-based pagination (100 items per page).

        :param sport_id: Filter by sport id
        :type sport_id: int
        :param sport_name: Filter by sport name
        :type sport_name: str
        :param tournament: Filter by tournament
        :type tournament: str
        :param teams: Filter by 1-2 team names (repeated query param)
        :type teams: List[Optional[str]]
        :param start_at_from: Filter by start time from (inclusive)
        :type start_at_from: datetime
        :param start_at_to: Filter by start time to (inclusive)
        :type start_at_to: datetime
        :param page: Page number (1-based)
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_matches_v1_matches_get_serialize(
            sport_id=sport_id,
            sport_name=sport_name,
            tournament=tournament,
            teams=teams,
            start_at_from=start_at_from,
            start_at_to=start_at_to,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginatedResponseMatchRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        await response_data.read()
        return self.api_client.response_deserialize(
            response_data=response_data,
            response_types_map=_response_types_map,
        )


    @validate_call
    async def get_matches_v1_matches_get_without_preload_content(
        self,
        sport_id: Annotated[Optional[StrictInt], Field(description="Filter by sport id")] = None,
        sport_name: Annotated[Optional[StrictStr], Field(description="Filter by sport name")] = None,
        tournament: Annotated[Optional[StrictStr], Field(description="Filter by tournament")] = None,
        teams: Annotated[Optional[List[Optional[StrictStr]]], Field(description="Filter by 1-2 team names (repeated query param)")] = None,
        start_at_from: Annotated[Optional[datetime], Field(description="Filter by start time from (inclusive)")] = None,
        start_at_to: Annotated[Optional[datetime], Field(description="Filter by start time to (inclusive)")] = None,
        page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based)")] = None,
        _request_timeout: Union[
            None,
            Annotated[StrictFloat, Field(gt=0)],
            Tuple[
                Annotated[StrictFloat, Field(gt=0)],
                Annotated[StrictFloat, Field(gt=0)]
            ]
        ] = None,
        _request_auth: Optional[Dict[StrictStr, Any]] = None,
        _content_type: Optional[StrictStr] = None,
        _headers: Optional[Dict[StrictStr, Any]] = None,
        _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
    ) -> RESTResponseType:
        """Get matches

        Returns matches with sport info and broadcasts. Supports filters and page-based pagination (100 items per page).

        :param sport_id: Filter by sport id
        :type sport_id: int
        :param sport_name: Filter by sport name
        :type sport_name: str
        :param tournament: Filter by tournament
        :type tournament: str
        :param teams: Filter by 1-2 team names (repeated query param)
        :type teams: List[Optional[str]]
        :param start_at_from: Filter by start time from (inclusive)
        :type start_at_from: datetime
        :param start_at_to: Filter by start time to (inclusive)
        :type start_at_to: datetime
        :param page: Page number (1-based)
        :type page: int
        :param _request_timeout: timeout setting for this request. If one
                                 number provided, it will be total request
                                 timeout. It can also be a pair (tuple) of
                                 (connection, read) timeouts.
        :type _request_timeout: int, tuple(int, int), optional
        :param _request_auth: set to override the auth_settings for an a single
                              request; this effectively ignores the
                              authentication in the spec for a single request.
        :type _request_auth: dict, optional
        :param _content_type: force content-type for the request.
        :type _content_type: str, Optional
        :param _headers: set to override the headers for a single
                         request; this effectively ignores the headers
                         in the spec for a single request.
        :type _headers: dict, optional
        :param _host_index: set to override the host_index for a single
                            request; this effectively ignores the host_index
                            in the spec for a single request.
        :type _host_index: int, optional
        :return: Returns the result object.
        """ # noqa: E501

        _param = self._get_matches_v1_matches_get_serialize(
            sport_id=sport_id,
            sport_name=sport_name,
            tournament=tournament,
            teams=teams,
            start_at_from=start_at_from,
            start_at_to=start_at_to,
            page=page,
            _request_auth=_request_auth,
            _content_type=_content_type,
            _headers=_headers,
            _host_index=_host_index
        )

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "PaginatedResponseMatchRead",
            '422': "HTTPValidationError",
        }
        response_data = await self.api_client.call_api(
            *_param,
            _request_timeout=_request_timeout
        )
        return response_data.response


    def _get_matches_v1_matches_get_serialize(
        self,
        sport_id,
        sport_name,
        tournament,
        teams,
        start_at_from,
        start_at_to,
        page,
        _request_auth,
        _content_type,
        _headers,
        _host_index,
    ) -> RequestSerialized:

        _host = None

        _collection_formats: Dict[str, str] = {
            'teams': 'multi',
        }

        _path_params: Dict[str, str] = {}
        _query_params: List[Tuple[str, str]] = []
        _header_params: Dict[str, Optional[str]] = _headers or {}
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[
            str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
        ] = {}
        _body_params: Optional[bytes] = None

        # process the path parameters
        # process the query parameters
        if sport_id is not None:
            
            _query_params.append(('sport_id', sport_id))
            
        if sport_name is not None:
            
            _query_params.append(('sport_name', sport_name))
            
        if tournament is not None:
            
            _query_params.append(('tournament', tournament))
            
        if teams is not None:
            
            _query_params.append(('teams', teams))
            
        if start_at_from is not None:
            if isinstance(start_at_from, datetime):
                _query_params.append(
                    (
                        'start_at_from',
                        start_at_from.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('start_at_from', start_at_from))
            
        if start_at_to is not None:
            if isinstance(start_at_to, datetime):
                _query_params.append(
                    (
                        'start_at_to',
                        start_at_to.strftime(
                            self.api_client.configuration.datetime_format
                        )
                    )
                )
            else:
                _query_params.append(('start_at_to', start_at_to))
            
        if page is not None:
            
            _query_params.append(('page', page))
            
        # process the header parameters
        # process the form parameters
        # process the body parameter


        # set the HTTP header `Accept`
        if 'Accept' not in _header_params:
            _header_params['Accept'] = self.api_client.select_header_accept(
                [
                    'application/json'
                ]
            )


        # authentication setting
        _auth_settings: List[str] = [
            'HTTPBearer'
        ]

        return self.api_client.param_serialize(
            method='GET',
            resource_path='/v1/matches',
            path_params=_path_params,
            query_params=_query_params,
            header_params=_header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            auth_settings=_auth_settings,
            collection_formats=_collection_formats,
            _host=_host,
            _request_auth=_request_auth
        )


