# coding: utf-8

"""
    FINBOURNE Access Management API

    FINBOURNE Technology  # noqa: E501

    Contact: info@finbourne.com
    Generated by OpenAPI Generator (https://openapi-generator.tech)

    Do not edit the class manually.
"""


from __future__ import annotations
import pprint
import re  # noqa: F401
import json


from typing import Any, Dict, Optional
from pydantic.v1 import BaseModel, Field
from finbourne_access.models.id_selector_definition import IdSelectorDefinition
from finbourne_access.models.match_all_selector_definition import MatchAllSelectorDefinition
from finbourne_access.models.metadata_selector_definition import MetadataSelectorDefinition

class SelectorDefinition(BaseModel):
    """
    SelectorDefinition
    """
    metadata_selector_definition: Optional[MetadataSelectorDefinition] = Field(None, alias="metadataSelectorDefinition")
    id_selector_definition: Optional[IdSelectorDefinition] = Field(None, alias="idSelectorDefinition")
    match_all_selector_definition: Optional[MatchAllSelectorDefinition] = Field(None, alias="matchAllSelectorDefinition")
    policy_selector_definition: Optional[PolicySelectorDefinition] = Field(None, alias="policySelectorDefinition")
    __properties = ["metadataSelectorDefinition", "idSelectorDefinition", "matchAllSelectorDefinition", "policySelectorDefinition"]

    class Config:
        """Pydantic configuration"""
        allow_population_by_field_name = True
        validate_assignment = True

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

    def to_json(self) -> str:
        """Returns the JSON representation of the model using alias"""
        return json.dumps(self.to_dict())

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

    def to_dict(self):
        """Returns the dictionary representation of the model using alias"""
        _dict = self.dict(by_alias=True,
                          exclude={
                          },
                          exclude_none=True)
        # override the default output from pydantic by calling `to_dict()` of metadata_selector_definition
        if self.metadata_selector_definition:
            _dict['metadataSelectorDefinition'] = self.metadata_selector_definition.to_dict()
        # override the default output from pydantic by calling `to_dict()` of id_selector_definition
        if self.id_selector_definition:
            _dict['idSelectorDefinition'] = self.id_selector_definition.to_dict()
        # override the default output from pydantic by calling `to_dict()` of match_all_selector_definition
        if self.match_all_selector_definition:
            _dict['matchAllSelectorDefinition'] = self.match_all_selector_definition.to_dict()
        # override the default output from pydantic by calling `to_dict()` of policy_selector_definition
        if self.policy_selector_definition:
            _dict['policySelectorDefinition'] = self.policy_selector_definition.to_dict()
        return _dict

    @classmethod
    def from_dict(cls, obj: dict) -> SelectorDefinition:
        """Create an instance of SelectorDefinition from a dict"""
        if obj is None:
            return None

        if not isinstance(obj, dict):
            return SelectorDefinition.parse_obj(obj)

        _obj = SelectorDefinition.parse_obj({
            "metadata_selector_definition": MetadataSelectorDefinition.from_dict(obj.get("metadataSelectorDefinition")) if obj.get("metadataSelectorDefinition") is not None else None,
            "id_selector_definition": IdSelectorDefinition.from_dict(obj.get("idSelectorDefinition")) if obj.get("idSelectorDefinition") is not None else None,
            "match_all_selector_definition": MatchAllSelectorDefinition.from_dict(obj.get("matchAllSelectorDefinition")) if obj.get("matchAllSelectorDefinition") is not None else None,
            "policy_selector_definition": PolicySelectorDefinition.from_dict(obj.get("policySelectorDefinition")) if obj.get("policySelectorDefinition") is not None else None
        })
        return _obj
from finbourne_access.models.policy_selector_definition import PolicySelectorDefinition

SelectorDefinition.update_forward_refs()
