# coding: utf-8

"""
    Metal API

    The version of the OpenAPI document: 1.0.0
    Contact: support@equinixmetal.com
    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from equinix.services.metalv1.models.spot_prices_per_facility import SpotPricesPerFacility
from equinix.services.metalv1.models.spot_prices_per_new_facility import SpotPricesPerNewFacility
from typing import Optional, Set
from typing_extensions import Self

class SpotPricesReport(BaseModel):
    """
    SpotPricesReport
    """ # noqa: E501
    ams1: Optional[SpotPricesPerFacility] = None
    atl1: Optional[SpotPricesPerNewFacility] = None
    dfw1: Optional[SpotPricesPerNewFacility] = None
    ewr1: Optional[SpotPricesPerFacility] = None
    fra1: Optional[SpotPricesPerNewFacility] = None
    href: Optional[StrictStr] = None
    iad1: Optional[SpotPricesPerNewFacility] = None
    lax1: Optional[SpotPricesPerNewFacility] = None
    nrt1: Optional[SpotPricesPerFacility] = None
    ord1: Optional[SpotPricesPerNewFacility] = None
    sea1: Optional[SpotPricesPerNewFacility] = None
    sin1: Optional[SpotPricesPerNewFacility] = None
    sjc1: Optional[SpotPricesPerFacility] = None
    syd1: Optional[SpotPricesPerNewFacility] = None
    yyz1: Optional[SpotPricesPerNewFacility] = None
    __properties: ClassVar[List[str]] = ["ams1", "atl1", "dfw1", "ewr1", "fra1", "href", "iad1", "lax1", "nrt1", "ord1", "sea1", "sin1", "sjc1", "syd1", "yyz1"]

    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 SpotPricesReport 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 ams1
        if self.ams1:
            _dict['ams1'] = self.ams1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of atl1
        if self.atl1:
            _dict['atl1'] = self.atl1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of dfw1
        if self.dfw1:
            _dict['dfw1'] = self.dfw1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of ewr1
        if self.ewr1:
            _dict['ewr1'] = self.ewr1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of fra1
        if self.fra1:
            _dict['fra1'] = self.fra1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of iad1
        if self.iad1:
            _dict['iad1'] = self.iad1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of lax1
        if self.lax1:
            _dict['lax1'] = self.lax1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of nrt1
        if self.nrt1:
            _dict['nrt1'] = self.nrt1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of ord1
        if self.ord1:
            _dict['ord1'] = self.ord1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of sea1
        if self.sea1:
            _dict['sea1'] = self.sea1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of sin1
        if self.sin1:
            _dict['sin1'] = self.sin1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of sjc1
        if self.sjc1:
            _dict['sjc1'] = self.sjc1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of syd1
        if self.syd1:
            _dict['syd1'] = self.syd1.to_dict()
        # override the default output from pydantic by calling `to_dict()` of yyz1
        if self.yyz1:
            _dict['yyz1'] = self.yyz1.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "ams1": SpotPricesPerFacility.from_dict(obj["ams1"]) if obj.get("ams1") is not None else None,
            "atl1": SpotPricesPerNewFacility.from_dict(obj["atl1"]) if obj.get("atl1") is not None else None,
            "dfw1": SpotPricesPerNewFacility.from_dict(obj["dfw1"]) if obj.get("dfw1") is not None else None,
            "ewr1": SpotPricesPerFacility.from_dict(obj["ewr1"]) if obj.get("ewr1") is not None else None,
            "fra1": SpotPricesPerNewFacility.from_dict(obj["fra1"]) if obj.get("fra1") is not None else None,
            "href": obj.get("href"),
            "iad1": SpotPricesPerNewFacility.from_dict(obj["iad1"]) if obj.get("iad1") is not None else None,
            "lax1": SpotPricesPerNewFacility.from_dict(obj["lax1"]) if obj.get("lax1") is not None else None,
            "nrt1": SpotPricesPerFacility.from_dict(obj["nrt1"]) if obj.get("nrt1") is not None else None,
            "ord1": SpotPricesPerNewFacility.from_dict(obj["ord1"]) if obj.get("ord1") is not None else None,
            "sea1": SpotPricesPerNewFacility.from_dict(obj["sea1"]) if obj.get("sea1") is not None else None,
            "sin1": SpotPricesPerNewFacility.from_dict(obj["sin1"]) if obj.get("sin1") is not None else None,
            "sjc1": SpotPricesPerFacility.from_dict(obj["sjc1"]) if obj.get("sjc1") is not None else None,
            "syd1": SpotPricesPerNewFacility.from_dict(obj["syd1"]) if obj.get("syd1") is not None else None,
            "yyz1": SpotPricesPerNewFacility.from_dict(obj["yyz1"]) if obj.get("yyz1") is not None else None
        })
        return _obj


