# 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 pprint
import re  # noqa: F401
import json

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional, Union
from esi_genoa_client.models.dogma_dynamic_items_type_id_item_id_get_dogma_attributes_inner import DogmaDynamicItemsTypeIdItemIdGetDogmaAttributesInner
from esi_genoa_client.models.dogma_dynamic_items_type_id_item_id_get_dogma_effects_inner import DogmaDynamicItemsTypeIdItemIdGetDogmaEffectsInner
from typing import Optional, Set
from typing_extensions import Self

class UniverseTypesTypeIdGet(BaseModel):
    """
    UniverseTypesTypeIdGet
    """ # noqa: E501
    capacity: Optional[Union[StrictFloat, StrictInt]] = None
    description: StrictStr
    dogma_attributes: Optional[List[DogmaDynamicItemsTypeIdItemIdGetDogmaAttributesInner]] = None
    dogma_effects: Optional[List[DogmaDynamicItemsTypeIdItemIdGetDogmaEffectsInner]] = None
    graphic_id: Optional[StrictInt] = None
    group_id: StrictInt
    icon_id: Optional[StrictInt] = None
    market_group_id: Optional[StrictInt] = Field(default=None, description="This only exists for types that can be put on the market")
    mass: Optional[Union[StrictFloat, StrictInt]] = None
    name: StrictStr
    packaged_volume: Optional[Union[StrictFloat, StrictInt]] = None
    portion_size: Optional[StrictInt] = None
    published: StrictBool
    radius: Optional[Union[StrictFloat, StrictInt]] = None
    type_id: StrictInt
    volume: Optional[Union[StrictFloat, StrictInt]] = None
    __properties: ClassVar[List[str]] = ["capacity", "description", "dogma_attributes", "dogma_effects", "graphic_id", "group_id", "icon_id", "market_group_id", "mass", "name", "packaged_volume", "portion_size", "published", "radius", "type_id", "volume"]

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


    def to_str(self) -> str:
        """Returns the string representation of the model using alias"""
        return pprint.pformat(self.model_dump(by_alias=True))

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
        return json.dumps(self.to_dict())

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of UniverseTypesTypeIdGet from a JSON string"""
        return cls.from_dict(json.loads(json_str))

    def to_dict(self) -> Dict[str, Any]:
        """Return the dictionary representation of the model using alias.

        This has the following differences from calling pydantic's
        `self.model_dump(by_alias=True)`:

        * `None` is only added to the output dict for nullable fields that
          were set at model initialization. Other fields with value `None`
          are ignored.
        """
        excluded_fields: Set[str] = set([
        ])

        _dict = self.model_dump(
            by_alias=True,
            exclude=excluded_fields,
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of each item in dogma_attributes (list)
        _items = []
        if self.dogma_attributes:
            for _item_dogma_attributes in self.dogma_attributes:
                if _item_dogma_attributes:
                    _items.append(_item_dogma_attributes.to_dict())
            _dict['dogma_attributes'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in dogma_effects (list)
        _items = []
        if self.dogma_effects:
            for _item_dogma_effects in self.dogma_effects:
                if _item_dogma_effects:
                    _items.append(_item_dogma_effects.to_dict())
            _dict['dogma_effects'] = _items
        return _dict

    @classmethod
    def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
        """Create an instance of UniverseTypesTypeIdGet from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return cls.model_validate(obj)

        _obj = cls.model_validate({
            "capacity": obj.get("capacity"),
            "description": obj.get("description"),
            "dogma_attributes": [DogmaDynamicItemsTypeIdItemIdGetDogmaAttributesInner.from_dict(_item) for _item in obj["dogma_attributes"]] if obj.get("dogma_attributes") is not None else None,
            "dogma_effects": [DogmaDynamicItemsTypeIdItemIdGetDogmaEffectsInner.from_dict(_item) for _item in obj["dogma_effects"]] if obj.get("dogma_effects") is not None else None,
            "graphic_id": obj.get("graphic_id"),
            "group_id": obj.get("group_id"),
            "icon_id": obj.get("icon_id"),
            "market_group_id": obj.get("market_group_id"),
            "mass": obj.get("mass"),
            "name": obj.get("name"),
            "packaged_volume": obj.get("packaged_volume"),
            "portion_size": obj.get("portion_size"),
            "published": obj.get("published"),
            "radius": obj.get("radius"),
            "type_id": obj.get("type_id"),
            "volume": obj.get("volume")
        })
        return _obj


