# coding: utf-8

"""
    RTU MIREA VUC

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

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

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


import re  # noqa: F401
import io
import warnings

from pydantic import validate_call, ValidationError
from typing import Dict, List, Optional, Tuple

from pydantic import Field
from typing_extensions import Annotated
from pydantic import StrictBool, StrictInt, field_validator

from typing import List, Optional

from schedule_service_client.models.platoon import Platoon
from schedule_service_client.models.schedule_result import ScheduleResult
from schedule_service_client.models.week_date import WeekDate
from schedule_service_client.models.week_schedule_result import WeekScheduleResult

from schedule_service_client.api_client import ApiClient
from schedule_service_client.api_response import ApiResponse
from schedule_service_client.exceptions import (  # noqa: F401
    ApiTypeError,
    ApiValueError
)


class ScheduleApi:
    """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_date_weeks_api_v1_schedule_week_date_get(
        self,
        course: StrictInt,
        semester: StrictInt,
        **kwargs,
    ) -> List[WeekDate]:
        """Get Date Weeks  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: List[WeekDate]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_date_weeks_api_v1_schedule_week_date_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)

        return await self.get_date_weeks_api_v1_schedule_week_date_get_with_http_info.raw_function(
            course,
            semester,
            **kwargs,
        )

    @validate_call
    async def get_date_weeks_api_v1_schedule_week_date_get_with_http_info(
        self,
        course: StrictInt,
        semester: StrictInt,
        **kwargs,
    ) -> ApiResponse:
        """Get Date Weeks  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(List[WeekDate], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'course',
            'semester'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_date_weeks_api_v1_schedule_week_date_get" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats: Dict[str, str] = {}

        # process the path parameters
        _path_params: Dict[str, str] = {}

        # process the query parameters
        _query_params: List[Tuple[str, str]] = []
        if _params.get('course') is not None:  # noqa: E501
            _query_params.append(('course', _params['course']))

        if _params.get('semester') is not None:  # noqa: E501
            _query_params.append(('semester', _params['semester']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, str] = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings: List[str] = []  # noqa: E501

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[WeekDate]",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/api/v1/schedule/week/date', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_call
    async def get_platoons_api_v1_schedule_platoons_get(
        self,
        course: StrictInt,
        semester: StrictInt,
        group_by_speciality_code: Optional[StrictBool] = None,
        **kwargs,
    ) -> List[Platoon]:
        """Get Platoons  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param group_by_speciality_code:
        :type group_by_speciality_code: bool
        :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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: List[Platoon]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_platoons_api_v1_schedule_platoons_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)

        return await self.get_platoons_api_v1_schedule_platoons_get_with_http_info.raw_function(
            course,
            semester,
            group_by_speciality_code,
            **kwargs,
        )

    @validate_call
    async def get_platoons_api_v1_schedule_platoons_get_with_http_info(
        self,
        course: StrictInt,
        semester: StrictInt,
        group_by_speciality_code: Optional[StrictBool] = None,
        **kwargs,
    ) -> ApiResponse:
        """Get Platoons  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param group_by_speciality_code:
        :type group_by_speciality_code: bool
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(List[Platoon], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'course',
            'semester',
            'group_by_speciality_code'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_platoons_api_v1_schedule_platoons_get" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats: Dict[str, str] = {}

        # process the path parameters
        _path_params: Dict[str, str] = {}

        # process the query parameters
        _query_params: List[Tuple[str, str]] = []
        if _params.get('course') is not None:  # noqa: E501
            _query_params.append(('course', _params['course']))

        if _params.get('semester') is not None:  # noqa: E501
            _query_params.append(('semester', _params['semester']))

        if _params.get('group_by_speciality_code') is not None:  # noqa: E501
            _query_params.append(('group_by_speciality_code', _params['group_by_speciality_code']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, str] = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings: List[str] = []  # noqa: E501

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[Platoon]",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/api/v1/schedule/platoons', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_call
    async def get_schedule_api_v1_schedule_get(
        self,
        course: StrictInt,
        semester: StrictInt,
        platoon: Annotated[Optional[StrictInt], Field(description="`e.g 222`")] = None,
        **kwargs,
    ) -> List[ScheduleResult]:
        """Get Schedule  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param platoon: `e.g 222`
        :type platoon: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: List[ScheduleResult]
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_schedule_api_v1_schedule_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)

        return await self.get_schedule_api_v1_schedule_get_with_http_info.raw_function(
            course,
            semester,
            platoon,
            **kwargs,
        )

    @validate_call
    async def get_schedule_api_v1_schedule_get_with_http_info(
        self,
        course: StrictInt,
        semester: StrictInt,
        platoon: Annotated[Optional[StrictInt], Field(description="`e.g 222`")] = None,
        **kwargs,
    ) -> ApiResponse:
        """Get Schedule  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param platoon: `e.g 222`
        :type platoon: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(List[ScheduleResult], status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'course',
            'semester',
            'platoon'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_schedule_api_v1_schedule_get" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats: Dict[str, str] = {}

        # process the path parameters
        _path_params: Dict[str, str] = {}

        # process the query parameters
        _query_params: List[Tuple[str, str]] = []
        if _params.get('course') is not None:  # noqa: E501
            _query_params.append(('course', _params['course']))

        if _params.get('semester') is not None:  # noqa: E501
            _query_params.append(('semester', _params['semester']))

        if _params.get('platoon') is not None:  # noqa: E501
            _query_params.append(('platoon', _params['platoon']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, str] = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings: List[str] = []  # noqa: E501

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "List[ScheduleResult]",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/api/v1/schedule/', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))

    @validate_call
    async def get_weeks_schedule_api_v1_schedule_week_get(
        self,
        course: StrictInt,
        semester: StrictInt,
        week: StrictInt,
        platoon: Annotated[Optional[StrictInt], Field(description="`e.g 222`")] = None,
        **kwargs,
    ) -> WeekScheduleResult:
        """Get Weeks Schedule  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param week: (required)
        :type week: int
        :param platoon: `e.g 222`
        :type platoon: 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.
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: WeekScheduleResult
        """
        kwargs['_return_http_data_only'] = True
        if '_preload_content' in kwargs:
            message = "Error! Please call the get_weeks_schedule_api_v1_schedule_week_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data"  # noqa: E501
            raise ValueError(message)

        return await self.get_weeks_schedule_api_v1_schedule_week_get_with_http_info.raw_function(
            course,
            semester,
            week,
            platoon,
            **kwargs,
        )

    @validate_call
    async def get_weeks_schedule_api_v1_schedule_week_get_with_http_info(
        self,
        course: StrictInt,
        semester: StrictInt,
        week: StrictInt,
        platoon: Annotated[Optional[StrictInt], Field(description="`e.g 222`")] = None,
        **kwargs,
    ) -> ApiResponse:
        """Get Weeks Schedule  # noqa: E501


        :param course: (required)
        :type course: int
        :param semester: (required)
        :type semester: int
        :param week: (required)
        :type week: int
        :param platoon: `e.g 222`
        :type platoon: int
        :param _preload_content: if False, the ApiResponse.data will
                                 be set to none and raw_data will store the
                                 HTTP response body without reading/decoding.
                                 Default is True.
        :type _preload_content: bool, optional
        :param _return_http_data_only: response data instead of ApiResponse
                                       object with status code, headers, etc
        :type _return_http_data_only: bool, optional
        :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.
        :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
        :type _content_type: string, optional: force content-type for the request
        :return: Returns the result object.
                 If the method is called asynchronously,
                 returns the request thread.
        :rtype: tuple(WeekScheduleResult, status_code(int), headers(HTTPHeaderDict))
        """

        _params = locals()

        _all_params = [
            'course',
            'semester',
            'week',
            'platoon'
        ]
        _all_params.extend(
            [
                '_return_http_data_only',
                '_preload_content',
                '_request_timeout',
                '_request_auth',
                '_content_type',
                '_headers'
            ]
        )

        # validate the arguments
        for _key, _val in _params['kwargs'].items():
            if _key not in _all_params:
                raise ApiTypeError(
                    "Got an unexpected keyword argument '%s'"
                    " to method get_weeks_schedule_api_v1_schedule_week_get" % _key
                )
            _params[_key] = _val
        del _params['kwargs']

        _collection_formats: Dict[str, str] = {}

        # process the path parameters
        _path_params: Dict[str, str] = {}

        # process the query parameters
        _query_params: List[Tuple[str, str]] = []
        if _params.get('course') is not None:  # noqa: E501
            _query_params.append(('course', _params['course']))

        if _params.get('semester') is not None:  # noqa: E501
            _query_params.append(('semester', _params['semester']))

        if _params.get('week') is not None:  # noqa: E501
            _query_params.append(('week', _params['week']))

        if _params.get('platoon') is not None:  # noqa: E501
            _query_params.append(('platoon', _params['platoon']))

        # process the header parameters
        _header_params = dict(_params.get('_headers', {}))
        # process the form parameters
        _form_params: List[Tuple[str, str]] = []
        _files: Dict[str, str] = {}
        # process the body parameter
        _body_params = None
        # set the HTTP header `Accept`
        _header_params['Accept'] = self.api_client.select_header_accept(
            ['application/json'])  # noqa: E501

        # authentication setting
        _auth_settings: List[str] = []  # noqa: E501

        _response_types_map: Dict[str, Optional[str]] = {
            '200': "WeekScheduleResult",
            '422': "HTTPValidationError",
        }

        return await self.api_client.call_api(
            '/api/v1/schedule/week', 'GET',
            _path_params,
            _query_params,
            _header_params,
            body=_body_params,
            post_params=_form_params,
            files=_files,
            response_types_map=_response_types_map,
            auth_settings=_auth_settings,
            _return_http_data_only=_params.get('_return_http_data_only'),  # noqa: E501
            _preload_content=_params.get('_preload_content', True),
            _request_timeout=_params.get('_request_timeout'),
            collection_formats=_collection_formats,
            _request_auth=_params.get('_request_auth'))
