# coding: utf-8

"""
    Identity Security Cloud V3 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: 3.0.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 datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional
from pydantic import BaseModel, StrictStr
from pydantic import Field
from sailpoint.v3.models.vendor_connector_mapping_deleted_at import VendorConnectorMappingDeletedAt
from sailpoint.v3.models.vendor_connector_mapping_deleted_by import VendorConnectorMappingDeletedBy
from sailpoint.v3.models.vendor_connector_mapping_updated_at import VendorConnectorMappingUpdatedAt
from sailpoint.v3.models.vendor_connector_mapping_updated_by import VendorConnectorMappingUpdatedBy
try:
    from typing import Self
except ImportError:
    from typing_extensions import Self

class VendorConnectorMapping(BaseModel):
    """
    VendorConnectorMapping
    """ # noqa: E501
    id: Optional[StrictStr] = Field(default=None, description="The unique identifier for the vendor-connector mapping.")
    vendor: Optional[StrictStr] = Field(default=None, description="The name of the vendor.")
    connector: Optional[StrictStr] = Field(default=None, description="The name of the connector.")
    created_at: Optional[datetime] = Field(default=None, description="The creation timestamp of the mapping.", alias="createdAt")
    created_by: Optional[StrictStr] = Field(default=None, description="The identifier of the user who created the mapping.", alias="createdBy")
    updated_at: Optional[VendorConnectorMappingUpdatedAt] = Field(default=None, alias="updatedAt")
    updated_by: Optional[VendorConnectorMappingUpdatedBy] = Field(default=None, alias="updatedBy")
    deleted_at: Optional[VendorConnectorMappingDeletedAt] = Field(default=None, alias="deletedAt")
    deleted_by: Optional[VendorConnectorMappingDeletedBy] = Field(default=None, alias="deletedBy")
    __properties: ClassVar[List[str]] = ["id", "vendor", "connector", "createdAt", "createdBy", "updatedAt", "updatedBy", "deletedAt", "deletedBy"]

    model_config = {
        "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) -> Self:
        """Create an instance of VendorConnectorMapping 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.
        """
        _dict = self.model_dump(
            by_alias=True,
            exclude={
            },
            exclude_none=True,
        )
        # override the default output from pydantic by calling `to_dict()` of updated_at
        if self.updated_at:
            _dict['updatedAt'] = self.updated_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of updated_by
        if self.updated_by:
            _dict['updatedBy'] = self.updated_by.to_dict()
        # override the default output from pydantic by calling `to_dict()` of deleted_at
        if self.deleted_at:
            _dict['deletedAt'] = self.deleted_at.to_dict()
        # override the default output from pydantic by calling `to_dict()` of deleted_by
        if self.deleted_by:
            _dict['deletedBy'] = self.deleted_by.to_dict()
        # set to None if updated_at (nullable) is None
        # and model_fields_set contains the field
        if self.updated_at is None and "updated_at" in self.model_fields_set:
            _dict['updatedAt'] = None

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "id": obj.get("id"),
            "vendor": obj.get("vendor"),
            "connector": obj.get("connector"),
            "createdAt": obj.get("createdAt"),
            "createdBy": obj.get("createdBy"),
            "updatedAt": VendorConnectorMappingUpdatedAt.from_dict(obj.get("updatedAt")) if obj.get("updatedAt") is not None else None,
            "updatedBy": VendorConnectorMappingUpdatedBy.from_dict(obj.get("updatedBy")) if obj.get("updatedBy") is not None else None,
            "deletedAt": VendorConnectorMappingDeletedAt.from_dict(obj.get("deletedAt")) if obj.get("deletedAt") is not None else None,
            "deletedBy": VendorConnectorMappingDeletedBy.from_dict(obj.get("deletedBy")) if obj.get("deletedBy") is not None else None
        })
        return _obj


