# coding: utf-8

"""
    Infisical API

    List of all available APIs that can be consumed

    The version of the OpenAPI document: 0.0.1
    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, Optional
from pydantic import BaseModel, Field, StrictStr

class ApiV1WorkspaceWorkspaceIdAuthorizationsGet200ResponseAuthorizationsInner(BaseModel):
    """
    ApiV1WorkspaceWorkspaceIdAuthorizationsGet200ResponseAuthorizationsInner
    """
    id: StrictStr = Field(...)
    project_id: StrictStr = Field(default=..., alias="projectId")
    integration: StrictStr = Field(...)
    team_id: Optional[StrictStr] = Field(default=None, alias="teamId")
    url: Optional[StrictStr] = None
    namespace: Optional[StrictStr] = None
    account_id: Optional[StrictStr] = Field(default=None, alias="accountId")
    metadata: Optional[Any] = None
    created_at: datetime = Field(default=..., alias="createdAt")
    updated_at: datetime = Field(default=..., alias="updatedAt")
    __properties = ["id", "projectId", "integration", "teamId", "url", "namespace", "accountId", "metadata", "createdAt", "updatedAt"]

    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) -> ApiV1WorkspaceWorkspaceIdAuthorizationsGet200ResponseAuthorizationsInner:
        """Create an instance of ApiV1WorkspaceWorkspaceIdAuthorizationsGet200ResponseAuthorizationsInner 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)
        # set to None if team_id (nullable) is None
        # and __fields_set__ contains the field
        if self.team_id is None and "team_id" in self.__fields_set__:
            _dict['teamId'] = None

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

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

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

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

        return _dict

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

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

        _obj = ApiV1WorkspaceWorkspaceIdAuthorizationsGet200ResponseAuthorizationsInner.parse_obj({
            "id": obj.get("id"),
            "project_id": obj.get("projectId"),
            "integration": obj.get("integration"),
            "team_id": obj.get("teamId"),
            "url": obj.get("url"),
            "namespace": obj.get("namespace"),
            "account_id": obj.get("accountId"),
            "metadata": obj.get("metadata"),
            "created_at": obj.get("createdAt"),
            "updated_at": obj.get("updatedAt")
        })
        return _obj


