# coding: utf-8

"""
    Inventory

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

    The version of the OpenAPI document: 1.0
    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, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class AzureContainerRegistryIntegrationEditDto(BaseModel):
    """
    AzureContainerRegistryIntegrationEditDto
    """ # noqa: E501
    azure_tenant_id: Optional[StrictStr] = Field(default=None, alias="azureTenantId")
    client_id: Optional[StrictStr] = Field(default=None, alias="clientId")
    client_secret: Optional[StrictStr] = Field(default=None, alias="clientSecret")
    subscription_id: Optional[StrictStr] = Field(default=None, alias="subscriptionId")
    broker_id: Optional[StrictStr] = Field(default=None, alias="brokerId")
    name: Optional[StrictStr] = None
    workspace_id: Optional[StrictStr] = Field(default=None, alias="workspaceId")
    ignore_warnings: Optional[StrictBool] = Field(default=False, alias="ignoreWarnings")
    __properties: ClassVar[List[str]] = ["azureTenantId", "clientId", "clientSecret", "subscriptionId", "brokerId", "name", "workspaceId", "ignoreWarnings"]

    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 AzureContainerRegistryIntegrationEditDto 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,
        )
        # set to None if azure_tenant_id (nullable) is None
        # and model_fields_set contains the field
        if self.azure_tenant_id is None and "azure_tenant_id" in self.model_fields_set:
            _dict['azureTenantId'] = None

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "azureTenantId": obj.get("azureTenantId"),
            "clientId": obj.get("clientId"),
            "clientSecret": obj.get("clientSecret"),
            "subscriptionId": obj.get("subscriptionId"),
            "brokerId": obj.get("brokerId"),
            "name": obj.get("name"),
            "workspaceId": obj.get("workspaceId"),
            "ignoreWarnings": obj.get("ignoreWarnings") if obj.get("ignoreWarnings") is not None else False
        })
        return _obj


