# coding: utf-8

"""
    Identity Security Cloud V2024 API

    Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.

    The version of the OpenAPI document: v2024
    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
import warnings

from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from sailpoint.v2024.models.report_config_dto import ReportConfigDTO
from typing import Optional, Set
from typing_extensions import Self

class OrgConfig(BaseModel):
    """
    DTO class for OrgConfig data accessible by customer external org admin (\"ORG_ADMIN\") users
    """ # noqa: E501
    org_name: Optional[StrictStr] = Field(default=None, description="The name of the org.", alias="orgName")
    time_zone: Optional[StrictStr] = Field(default=None, description="The selected time zone which is to be used for the org.  This directly affects when scheduled tasks are executed.  Valid options can be found at /beta/org-config/valid-time-zones", alias="timeZone")
    lcs_change_honors_source_enable_feature: Optional[StrictBool] = Field(default=None, description="Flag to determine whether the LCS_CHANGE_HONORS_SOURCE_ENABLE_FEATURE flag is enabled for the current org.", alias="lcsChangeHonorsSourceEnableFeature")
    arm_customer_id: Optional[StrictStr] = Field(default=None, description="ARM Customer ID", alias="armCustomerId")
    arm_sap_system_id_mappings: Optional[StrictStr] = Field(default=None, description="A list of IDN::sourceId to ARM::systemId mappings.", alias="armSapSystemIdMappings")
    arm_auth: Optional[StrictStr] = Field(default=None, description="ARM authentication string", alias="armAuth")
    arm_db: Optional[StrictStr] = Field(default=None, description="ARM database name", alias="armDb")
    arm_sso_url: Optional[StrictStr] = Field(default=None, description="ARM SSO URL", alias="armSsoUrl")
    iai_enable_certification_recommendations: Optional[StrictBool] = Field(default=None, description="Flag to determine whether IAI Certification Recommendations are enabled for the current org", alias="iaiEnableCertificationRecommendations")
    sod_report_configs: Optional[List[ReportConfigDTO]] = Field(default=None, alias="sodReportConfigs")
    __properties: ClassVar[List[str]] = ["orgName", "timeZone", "lcsChangeHonorsSourceEnableFeature", "armCustomerId", "armSapSystemIdMappings", "armAuth", "armDb", "armSsoUrl", "iaiEnableCertificationRecommendations", "sodReportConfigs"]

    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 OrgConfig 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 sod_report_configs (list)
        _items = []
        if self.sod_report_configs:
            for _item_sod_report_configs in self.sod_report_configs:
                if _item_sod_report_configs:
                    _items.append(_item_sod_report_configs.to_dict())
            _dict['sodReportConfigs'] = _items
        # set to None if arm_customer_id (nullable) is None
        # and model_fields_set contains the field
        if self.arm_customer_id is None and "arm_customer_id" in self.model_fields_set:
            _dict['armCustomerId'] = None

        # set to None if arm_sap_system_id_mappings (nullable) is None
        # and model_fields_set contains the field
        if self.arm_sap_system_id_mappings is None and "arm_sap_system_id_mappings" in self.model_fields_set:
            _dict['armSapSystemIdMappings'] = None

        # set to None if arm_auth (nullable) is None
        # and model_fields_set contains the field
        if self.arm_auth is None and "arm_auth" in self.model_fields_set:
            _dict['armAuth'] = None

        # set to None if arm_db (nullable) is None
        # and model_fields_set contains the field
        if self.arm_db is None and "arm_db" in self.model_fields_set:
            _dict['armDb'] = None

        # set to None if arm_sso_url (nullable) is None
        # and model_fields_set contains the field
        if self.arm_sso_url is None and "arm_sso_url" in self.model_fields_set:
            _dict['armSsoUrl'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "orgName": obj.get("orgName"),
            "timeZone": obj.get("timeZone"),
            "lcsChangeHonorsSourceEnableFeature": obj.get("lcsChangeHonorsSourceEnableFeature"),
            "armCustomerId": obj.get("armCustomerId"),
            "armSapSystemIdMappings": obj.get("armSapSystemIdMappings"),
            "armAuth": obj.get("armAuth"),
            "armDb": obj.get("armDb"),
            "armSsoUrl": obj.get("armSsoUrl"),
            "iaiEnableCertificationRecommendations": obj.get("iaiEnableCertificationRecommendations"),
            "sodReportConfigs": [ReportConfigDTO.from_dict(_item) for _item in obj["sodReportConfigs"]] if obj.get("sodReportConfigs") is not None else None
        })
        return _obj


