# coding: utf-8

"""
    EVE Stable Infrastructure (ESI) - tranquility

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

    The version of the OpenAPI document: 2025-12-16
    Contact: arcyfa_github@pm.me
    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 esi_genoa_client.models.capture_fw_complex import CaptureFwComplex
from esi_genoa_client.models.damage_ship import DamageShip
from esi_genoa_client.models.defend_fw_complex import DefendFwComplex
from esi_genoa_client.models.deliver_item import DeliverItem
from esi_genoa_client.models.destroy_npc import DestroyNpc
from esi_genoa_client.models.destroy_ship import DestroyShip
from esi_genoa_client.models.earn_loyalty_point import EarnLoyaltyPoint
from esi_genoa_client.models.lost_ship import LostShip
from esi_genoa_client.models.manual import Manual
from esi_genoa_client.models.manufacture_item import ManufactureItem
from esi_genoa_client.models.mine_material import MineMaterial
from esi_genoa_client.models.remote_boost_shield import RemoteBoostShield
from esi_genoa_client.models.remote_repair_armor import RemoteRepairArmor
from esi_genoa_client.models.salvage_wreck import SalvageWreck
from esi_genoa_client.models.scan_signature import ScanSignature
from esi_genoa_client.models.ship_insurance import ShipInsurance
from esi_genoa_client.models.unknown import Unknown
from pydantic import StrictStr, Field
from typing import Union, List, Set, Optional, Dict
from typing_extensions import Literal, Self

CORPORATIONSPROJECTSDETAILCONFIGURATION_ONE_OF_SCHEMAS = ["CaptureFwComplex", "DamageShip", "DefendFwComplex", "DeliverItem", "DestroyNpc", "DestroyShip", "EarnLoyaltyPoint", "LostShip", "Manual", "ManufactureItem", "MineMaterial", "RemoteBoostShield", "RemoteRepairArmor", "SalvageWreck", "ScanSignature", "ShipInsurance", "Unknown"]

class CorporationsProjectsDetailConfiguration(BaseModel):
    """
    Project's configuration
    """
    # data type: CaptureFwComplex
    oneof_schema_1_validator: Optional[CaptureFwComplex] = None
    # data type: DamageShip
    oneof_schema_2_validator: Optional[DamageShip] = None
    # data type: DefendFwComplex
    oneof_schema_3_validator: Optional[DefendFwComplex] = None
    # data type: DeliverItem
    oneof_schema_4_validator: Optional[DeliverItem] = None
    # data type: DestroyNpc
    oneof_schema_5_validator: Optional[DestroyNpc] = None
    # data type: DestroyShip
    oneof_schema_6_validator: Optional[DestroyShip] = None
    # data type: EarnLoyaltyPoint
    oneof_schema_7_validator: Optional[EarnLoyaltyPoint] = None
    # data type: LostShip
    oneof_schema_8_validator: Optional[LostShip] = None
    # data type: Manual
    oneof_schema_9_validator: Optional[Manual] = None
    # data type: ManufactureItem
    oneof_schema_10_validator: Optional[ManufactureItem] = None
    # data type: MineMaterial
    oneof_schema_11_validator: Optional[MineMaterial] = None
    # data type: RemoteBoostShield
    oneof_schema_12_validator: Optional[RemoteBoostShield] = None
    # data type: RemoteRepairArmor
    oneof_schema_13_validator: Optional[RemoteRepairArmor] = None
    # data type: SalvageWreck
    oneof_schema_14_validator: Optional[SalvageWreck] = None
    # data type: ScanSignature
    oneof_schema_15_validator: Optional[ScanSignature] = None
    # data type: ShipInsurance
    oneof_schema_16_validator: Optional[ShipInsurance] = None
    # data type: Unknown
    oneof_schema_17_validator: Optional[Unknown] = None
    actual_instance: Optional[Union[CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown]] = None
    one_of_schemas: Set[str] = { "CaptureFwComplex", "DamageShip", "DefendFwComplex", "DeliverItem", "DestroyNpc", "DestroyShip", "EarnLoyaltyPoint", "LostShip", "Manual", "ManufactureItem", "MineMaterial", "RemoteBoostShield", "RemoteRepairArmor", "SalvageWreck", "ScanSignature", "ShipInsurance", "Unknown" }

    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 = CorporationsProjectsDetailConfiguration.model_construct()
        error_messages = []
        match = 0
        # validate data type: CaptureFwComplex
        if not isinstance(v, CaptureFwComplex):
            error_messages.append(f"Error! Input type `{type(v)}` is not `CaptureFwComplex`")
        else:
            match += 1
        # validate data type: DamageShip
        if not isinstance(v, DamageShip):
            error_messages.append(f"Error! Input type `{type(v)}` is not `DamageShip`")
        else:
            match += 1
        # validate data type: DefendFwComplex
        if not isinstance(v, DefendFwComplex):
            error_messages.append(f"Error! Input type `{type(v)}` is not `DefendFwComplex`")
        else:
            match += 1
        # validate data type: DeliverItem
        if not isinstance(v, DeliverItem):
            error_messages.append(f"Error! Input type `{type(v)}` is not `DeliverItem`")
        else:
            match += 1
        # validate data type: DestroyNpc
        if not isinstance(v, DestroyNpc):
            error_messages.append(f"Error! Input type `{type(v)}` is not `DestroyNpc`")
        else:
            match += 1
        # validate data type: DestroyShip
        if not isinstance(v, DestroyShip):
            error_messages.append(f"Error! Input type `{type(v)}` is not `DestroyShip`")
        else:
            match += 1
        # validate data type: EarnLoyaltyPoint
        if not isinstance(v, EarnLoyaltyPoint):
            error_messages.append(f"Error! Input type `{type(v)}` is not `EarnLoyaltyPoint`")
        else:
            match += 1
        # validate data type: LostShip
        if not isinstance(v, LostShip):
            error_messages.append(f"Error! Input type `{type(v)}` is not `LostShip`")
        else:
            match += 1
        # validate data type: Manual
        if not isinstance(v, Manual):
            error_messages.append(f"Error! Input type `{type(v)}` is not `Manual`")
        else:
            match += 1
        # validate data type: ManufactureItem
        if not isinstance(v, ManufactureItem):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ManufactureItem`")
        else:
            match += 1
        # validate data type: MineMaterial
        if not isinstance(v, MineMaterial):
            error_messages.append(f"Error! Input type `{type(v)}` is not `MineMaterial`")
        else:
            match += 1
        # validate data type: RemoteBoostShield
        if not isinstance(v, RemoteBoostShield):
            error_messages.append(f"Error! Input type `{type(v)}` is not `RemoteBoostShield`")
        else:
            match += 1
        # validate data type: RemoteRepairArmor
        if not isinstance(v, RemoteRepairArmor):
            error_messages.append(f"Error! Input type `{type(v)}` is not `RemoteRepairArmor`")
        else:
            match += 1
        # validate data type: SalvageWreck
        if not isinstance(v, SalvageWreck):
            error_messages.append(f"Error! Input type `{type(v)}` is not `SalvageWreck`")
        else:
            match += 1
        # validate data type: ScanSignature
        if not isinstance(v, ScanSignature):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ScanSignature`")
        else:
            match += 1
        # validate data type: ShipInsurance
        if not isinstance(v, ShipInsurance):
            error_messages.append(f"Error! Input type `{type(v)}` is not `ShipInsurance`")
        else:
            match += 1
        # validate data type: Unknown
        if not isinstance(v, Unknown):
            error_messages.append(f"Error! Input type `{type(v)}` is not `Unknown`")
        else:
            match += 1
        if match > 1:
            # more than 1 match
            raise ValueError("Multiple matches found when setting `actual_instance` in CorporationsProjectsDetailConfiguration with oneOf schemas: CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when setting `actual_instance` in CorporationsProjectsDetailConfiguration with oneOf schemas: CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown. 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 CaptureFwComplex
        try:
            instance.actual_instance = CaptureFwComplex.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into DamageShip
        try:
            instance.actual_instance = DamageShip.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into DefendFwComplex
        try:
            instance.actual_instance = DefendFwComplex.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into DeliverItem
        try:
            instance.actual_instance = DeliverItem.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into DestroyNpc
        try:
            instance.actual_instance = DestroyNpc.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into DestroyShip
        try:
            instance.actual_instance = DestroyShip.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into EarnLoyaltyPoint
        try:
            instance.actual_instance = EarnLoyaltyPoint.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into LostShip
        try:
            instance.actual_instance = LostShip.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into Manual
        try:
            instance.actual_instance = Manual.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ManufactureItem
        try:
            instance.actual_instance = ManufactureItem.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into MineMaterial
        try:
            instance.actual_instance = MineMaterial.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into RemoteBoostShield
        try:
            instance.actual_instance = RemoteBoostShield.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into RemoteRepairArmor
        try:
            instance.actual_instance = RemoteRepairArmor.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into SalvageWreck
        try:
            instance.actual_instance = SalvageWreck.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ScanSignature
        try:
            instance.actual_instance = ScanSignature.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into ShipInsurance
        try:
            instance.actual_instance = ShipInsurance.from_json(json_str)
            match += 1
        except (ValidationError, ValueError) as e:
            error_messages.append(str(e))
        # deserialize data into Unknown
        try:
            instance.actual_instance = Unknown.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 CorporationsProjectsDetailConfiguration with oneOf schemas: CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown. Details: " + ", ".join(error_messages))
        elif match == 0:
            # no match
            raise ValueError("No match found when deserializing the JSON string into CorporationsProjectsDetailConfiguration with oneOf schemas: CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown. 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], CaptureFwComplex, DamageShip, DefendFwComplex, DeliverItem, DestroyNpc, DestroyShip, EarnLoyaltyPoint, LostShip, Manual, ManufactureItem, MineMaterial, RemoteBoostShield, RemoteRepairArmor, SalvageWreck, ScanSignature, ShipInsurance, Unknown]]:
        """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())


