# coding: utf-8

"""
    Screening AI API Docs

    API Documentation for Screening AI

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

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


from __future__ import annotations
import json
import pprint
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
from typing import Any, List, Optional
from screening_ai.models.create_platform_organisation_billing_stripe_session_response_dto import CreatePlatformOrganisationBillingStripeSessionResponseDto
from screening_ai.models.create_platform_screening_submission_response_dto import CreatePlatformScreeningSubmissionResponseDto
from screening_ai.models.get_all_organisation_member_status_of_org_list_response_dto import GetAllOrganisationMemberStatusOfOrgListResponseDto
from screening_ai.models.get_all_platform_screening_templates_of_org_response_dto import GetAllPlatformScreeningTemplatesOfOrgResponseDto
from screening_ai.models.get_organisation_billing_via_org_id_response_dto import GetOrganisationBillingViaOrgIdResponseDto
from screening_ai.models.get_organisation_member_status_response_dto import GetOrganisationMemberStatusResponseDto
from screening_ai.models.get_platform_organisation_api_key_response_dto import GetPlatformOrganisationApiKeyResponseDto
from screening_ai.models.platform_organisation_response_dto import PlatformOrganisationResponseDto
from screening_ai.models.platform_organisations_list_response_dto import PlatformOrganisationsListResponseDto
from screening_ai.models.platform_screening_job_list_response_dto import PlatformScreeningJobListResponseDto
from screening_ai.models.platform_screening_job_response_dto import PlatformScreeningJobResponseDto
from screening_ai.models.platform_screening_submission_create_stream_room_response_dto import PlatformScreeningSubmissionCreateStreamRoomResponseDto
from screening_ai.models.platform_screening_submission_list_response_dto import PlatformScreeningSubmissionListResponseDto
from screening_ai.models.platform_screening_submission_response_dto import PlatformScreeningSubmissionResponseDto
from screening_ai.models.platform_screening_submission_text_from_audio_response_dto import PlatformScreeningSubmissionTextFromAudioResponseDto
from screening_ai.models.platform_user_jwt_response_dto import PlatformUserJwtResponseDto
from screening_ai.models.platform_user_response_dto import PlatformUserResponseDto
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

APIRESPONSEWRAPPERDATA_ONE_OF_SCHEMAS = ["CreatePlatformOrganisationBillingStripeSessionResponseDto", "CreatePlatformScreeningSubmissionResponseDto", "GetAllOrganisationMemberStatusOfOrgListResponseDto", "GetAllPlatformScreeningTemplatesOfOrgResponseDto", "GetOrganisationBillingViaOrgIdResponseDto", "GetOrganisationMemberStatusResponseDto", "GetPlatformOrganisationApiKeyResponseDto", "PlatformOrganisationResponseDto", "PlatformOrganisationsListResponseDto", "PlatformScreeningJobListResponseDto", "PlatformScreeningJobResponseDto", "PlatformScreeningSubmissionCreateStreamRoomResponseDto", "PlatformScreeningSubmissionListResponseDto", "PlatformScreeningSubmissionResponseDto", "PlatformScreeningSubmissionTextFromAudioResponseDto", "PlatformUserJwtResponseDto", "PlatformUserResponseDto"]

class ApiResponseWrapperData(BaseModel):
    """
    Actual response data
    """
    # data type: PlatformScreeningSubmissionCreateStreamRoomResponseDto
    oneof_schema_1_validator: Optional[PlatformScreeningSubmissionCreateStreamRoomResponseDto] = None
    # data type: PlatformScreeningSubmissionTextFromAudioResponseDto
    oneof_schema_2_validator: Optional[PlatformScreeningSubmissionTextFromAudioResponseDto] = None
    # data type: PlatformScreeningSubmissionResponseDto
    oneof_schema_3_validator: Optional[PlatformScreeningSubmissionResponseDto] = None
    # data type: PlatformScreeningSubmissionListResponseDto
    oneof_schema_4_validator: Optional[PlatformScreeningSubmissionListResponseDto] = None
    # data type: CreatePlatformScreeningSubmissionResponseDto
    oneof_schema_5_validator: Optional[CreatePlatformScreeningSubmissionResponseDto] = None
    # data type: GetAllPlatformScreeningTemplatesOfOrgResponseDto
    oneof_schema_6_validator: Optional[GetAllPlatformScreeningTemplatesOfOrgResponseDto] = None
    # data type: PlatformScreeningJobResponseDto
    oneof_schema_7_validator: Optional[PlatformScreeningJobResponseDto] = None
    # data type: PlatformScreeningJobListResponseDto
    oneof_schema_8_validator: Optional[PlatformScreeningJobListResponseDto] = None
    # data type: PlatformUserResponseDto
    oneof_schema_9_validator: Optional[PlatformUserResponseDto] = None
    # data type: PlatformUserJwtResponseDto
    oneof_schema_10_validator: Optional[PlatformUserJwtResponseDto] = None
    # data type: PlatformOrganisationResponseDto
    oneof_schema_11_validator: Optional[PlatformOrganisationResponseDto] = None
    # data type: PlatformOrganisationsListResponseDto
    oneof_schema_12_validator: Optional[PlatformOrganisationsListResponseDto] = None
    # data type: GetPlatformOrganisationApiKeyResponseDto
    oneof_schema_13_validator: Optional[GetPlatformOrganisationApiKeyResponseDto] = None
    # data type: GetOrganisationBillingViaOrgIdResponseDto
    oneof_schema_14_validator: Optional[GetOrganisationBillingViaOrgIdResponseDto] = None
    # data type: CreatePlatformOrganisationBillingStripeSessionResponseDto
    oneof_schema_15_validator: Optional[CreatePlatformOrganisationBillingStripeSessionResponseDto] = None
    # data type: GetOrganisationMemberStatusResponseDto
    oneof_schema_16_validator: Optional[GetOrganisationMemberStatusResponseDto] = None
    # data type: GetAllOrganisationMemberStatusOfOrgListResponseDto
    oneof_schema_17_validator: Optional[GetAllOrganisationMemberStatusOfOrgListResponseDto] = None
    actual_instance: Optional[Union[CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto]] = None
    one_of_schemas: Set[str] = { "CreatePlatformOrganisationBillingStripeSessionResponseDto", "CreatePlatformScreeningSubmissionResponseDto", "GetAllOrganisationMemberStatusOfOrgListResponseDto", "GetAllPlatformScreeningTemplatesOfOrgResponseDto", "GetOrganisationBillingViaOrgIdResponseDto", "GetOrganisationMemberStatusResponseDto", "GetPlatformOrganisationApiKeyResponseDto", "PlatformOrganisationResponseDto", "PlatformOrganisationsListResponseDto", "PlatformScreeningJobListResponseDto", "PlatformScreeningJobResponseDto", "PlatformScreeningSubmissionCreateStreamRoomResponseDto", "PlatformScreeningSubmissionListResponseDto", "PlatformScreeningSubmissionResponseDto", "PlatformScreeningSubmissionTextFromAudioResponseDto", "PlatformUserJwtResponseDto", "PlatformUserResponseDto" }

    model_config = ConfigDict(
        validate_assignment=True,
        protected_namespaces=(),
    )


    def __init__(self, *args, **kwargs) -> None:
        if args:
            if len(args) > 1:
                raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
            if kwargs:
                raise ValueError("If a position argument is used, keyword arguments cannot be used.")
            super().__init__(actual_instance=args[0])
        else:
            super().__init__(**kwargs)

    @field_validator('actual_instance')
    def actual_instance_must_validate_oneof(cls, v):
        instance = ApiResponseWrapperData.model_construct()
        error_messages = []
        match = 0
        # validate data type: PlatformScreeningSubmissionCreateStreamRoomResponseDto
        if not isinstance(v, PlatformScreeningSubmissionCreateStreamRoomResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningSubmissionCreateStreamRoomResponseDto`")
        else:
            match += 1
        # validate data type: PlatformScreeningSubmissionTextFromAudioResponseDto
        if not isinstance(v, PlatformScreeningSubmissionTextFromAudioResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningSubmissionTextFromAudioResponseDto`")
        else:
            match += 1
        # validate data type: PlatformScreeningSubmissionResponseDto
        if not isinstance(v, PlatformScreeningSubmissionResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningSubmissionResponseDto`")
        else:
            match += 1
        # validate data type: PlatformScreeningSubmissionListResponseDto
        if not isinstance(v, PlatformScreeningSubmissionListResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningSubmissionListResponseDto`")
        else:
            match += 1
        # validate data type: CreatePlatformScreeningSubmissionResponseDto
        if not isinstance(v, CreatePlatformScreeningSubmissionResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CreatePlatformScreeningSubmissionResponseDto`")
        else:
            match += 1
        # validate data type: GetAllPlatformScreeningTemplatesOfOrgResponseDto
        if not isinstance(v, GetAllPlatformScreeningTemplatesOfOrgResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GetAllPlatformScreeningTemplatesOfOrgResponseDto`")
        else:
            match += 1
        # validate data type: PlatformScreeningJobResponseDto
        if not isinstance(v, PlatformScreeningJobResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningJobResponseDto`")
        else:
            match += 1
        # validate data type: PlatformScreeningJobListResponseDto
        if not isinstance(v, PlatformScreeningJobListResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformScreeningJobListResponseDto`")
        else:
            match += 1
        # validate data type: PlatformUserResponseDto
        if not isinstance(v, PlatformUserResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformUserResponseDto`")
        else:
            match += 1
        # validate data type: PlatformUserJwtResponseDto
        if not isinstance(v, PlatformUserJwtResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformUserJwtResponseDto`")
        else:
            match += 1
        # validate data type: PlatformOrganisationResponseDto
        if not isinstance(v, PlatformOrganisationResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformOrganisationResponseDto`")
        else:
            match += 1
        # validate data type: PlatformOrganisationsListResponseDto
        if not isinstance(v, PlatformOrganisationsListResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `PlatformOrganisationsListResponseDto`")
        else:
            match += 1
        # validate data type: GetPlatformOrganisationApiKeyResponseDto
        if not isinstance(v, GetPlatformOrganisationApiKeyResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GetPlatformOrganisationApiKeyResponseDto`")
        else:
            match += 1
        # validate data type: GetOrganisationBillingViaOrgIdResponseDto
        if not isinstance(v, GetOrganisationBillingViaOrgIdResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GetOrganisationBillingViaOrgIdResponseDto`")
        else:
            match += 1
        # validate data type: CreatePlatformOrganisationBillingStripeSessionResponseDto
        if not isinstance(v, CreatePlatformOrganisationBillingStripeSessionResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CreatePlatformOrganisationBillingStripeSessionResponseDto`")
        else:
            match += 1
        # validate data type: GetOrganisationMemberStatusResponseDto
        if not isinstance(v, GetOrganisationMemberStatusResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GetOrganisationMemberStatusResponseDto`")
        else:
            match += 1
        # validate data type: GetAllOrganisationMemberStatusOfOrgListResponseDto
        if not isinstance(v, GetAllOrganisationMemberStatusOfOrgListResponseDto):
            error_messages.append(f"Error! Input type `{type(v)}` is not `GetAllOrganisationMemberStatusOfOrgListResponseDto`")
        else:
            match += 1
        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when setting `actual_instance` in ApiResponseWrapperData with oneOf schemas: CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when setting `actual_instance` in ApiResponseWrapperData with oneOf schemas: CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto. Details: " + ", ".join(error_messages))
        else:
            return v

    @classmethod
    def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
        return cls.from_json(json.dumps(obj))

    @classmethod
    def from_json(cls, json_str: str) -> Self:
        """Returns the object represented by the json string"""
        instance = cls.model_construct()
        error_messages = []
        match = 0

        # deserialize data into PlatformScreeningSubmissionCreateStreamRoomResponseDto
        try:
            instance.actual_instance = PlatformScreeningSubmissionCreateStreamRoomResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformScreeningSubmissionTextFromAudioResponseDto
        try:
            instance.actual_instance = PlatformScreeningSubmissionTextFromAudioResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformScreeningSubmissionResponseDto
        try:
            instance.actual_instance = PlatformScreeningSubmissionResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformScreeningSubmissionListResponseDto
        try:
            instance.actual_instance = PlatformScreeningSubmissionListResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into CreatePlatformScreeningSubmissionResponseDto
        try:
            instance.actual_instance = CreatePlatformScreeningSubmissionResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GetAllPlatformScreeningTemplatesOfOrgResponseDto
        try:
            instance.actual_instance = GetAllPlatformScreeningTemplatesOfOrgResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformScreeningJobResponseDto
        try:
            instance.actual_instance = PlatformScreeningJobResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformScreeningJobListResponseDto
        try:
            instance.actual_instance = PlatformScreeningJobListResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformUserResponseDto
        try:
            instance.actual_instance = PlatformUserResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformUserJwtResponseDto
        try:
            instance.actual_instance = PlatformUserJwtResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformOrganisationResponseDto
        try:
            instance.actual_instance = PlatformOrganisationResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into PlatformOrganisationsListResponseDto
        try:
            instance.actual_instance = PlatformOrganisationsListResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GetPlatformOrganisationApiKeyResponseDto
        try:
            instance.actual_instance = GetPlatformOrganisationApiKeyResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GetOrganisationBillingViaOrgIdResponseDto
        try:
            instance.actual_instance = GetOrganisationBillingViaOrgIdResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into CreatePlatformOrganisationBillingStripeSessionResponseDto
        try:
            instance.actual_instance = CreatePlatformOrganisationBillingStripeSessionResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GetOrganisationMemberStatusResponseDto
        try:
            instance.actual_instance = GetOrganisationMemberStatusResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into GetAllOrganisationMemberStatusOfOrgListResponseDto
        try:
            instance.actual_instance = GetAllOrganisationMemberStatusOfOrgListResponseDto.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))

        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when deserializing the JSON string into ApiResponseWrapperData with oneOf schemas: CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when deserializing the JSON string into ApiResponseWrapperData with oneOf schemas: CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto. Details: " + ", ".join(error_messages))
        else:
            return instance

    def to_json(self) -> str:
        """Returns the JSON representation of the actual instance"""
        if self.actual_instance is None:
            return "null"

        if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
            return self.actual_instance.to_json()
        else:
            return json.dumps(self.actual_instance)

    def to_dict(self) -> Optional[Union[Dict[str, Any], CreatePlatformOrganisationBillingStripeSessionResponseDto, CreatePlatformScreeningSubmissionResponseDto, GetAllOrganisationMemberStatusOfOrgListResponseDto, GetAllPlatformScreeningTemplatesOfOrgResponseDto, GetOrganisationBillingViaOrgIdResponseDto, GetOrganisationMemberStatusResponseDto, GetPlatformOrganisationApiKeyResponseDto, PlatformOrganisationResponseDto, PlatformOrganisationsListResponseDto, PlatformScreeningJobListResponseDto, PlatformScreeningJobResponseDto, PlatformScreeningSubmissionCreateStreamRoomResponseDto, PlatformScreeningSubmissionListResponseDto, PlatformScreeningSubmissionResponseDto, PlatformScreeningSubmissionTextFromAudioResponseDto, PlatformUserJwtResponseDto, PlatformUserResponseDto]]:
        """Returns the dict representation of the actual instance"""
        if self.actual_instance is None:
            return None

        if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
            return self.actual_instance.to_dict()
        else:
            # primitive type
            return self.actual_instance

    def to_str(self) -> str:
        """Returns the string representation of the actual instance"""
        return pprint.pformat(self.model_dump())


