# coding: utf-8

"""
    UniCourt Enterprise APIs

    <button><a href=\"/developers/enterpriseapi/api/download/UniCourt-Enterprise-API-Spec.yaml\" >Download UniCourt Enterprise APIs Specification</a></button> 

    The version of the OpenAPI document: 
    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 pydantic import BaseModel, ConfigDict, Field
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from typing import Optional, Set
from typing_extensions import Self

class BarSourceDataDisciplinaryHistoryArrayInner(BaseModel):
    """
    BarSourceDataDisciplinaryHistoryArrayInner
    """ # noqa: E501
    action: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    case_number: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="caseNumber")
    complaint: Optional[Annotated[str, Field(strict=True, max_length=1000)]] = None
    contact_id: Optional[Annotated[str, Field(min_length=1, strict=True, max_length=250)]] = Field(default=None, alias="contactId")
    date_of_action: Optional[datetime] = Field(default=None, alias="dateOfAction")
    definition: Optional[Annotated[str, Field(strict=True, max_length=1000)]] = None
    disciplinary_decision: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="disciplinaryDecision")
    entry_date: Optional[datetime] = Field(default=None, alias="entryDate")
    information: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    link: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    note: Optional[Annotated[str, Field(strict=True, max_length=1000)]] = None
    probation_date: Optional[datetime] = Field(default=None, alias="probationDate")
    reinstated_date: Optional[datetime] = Field(default=None, alias="reinstatedDate")
    rule: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    rule_number: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="ruleNumber")
    section_date: Optional[datetime] = Field(default=None, alias="sectionDate")
    status: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    stay_date: Optional[datetime] = Field(default=None, alias="stayDate")
    supreme_court: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="supremeCourt")
    term: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    type_of_action: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="typeOfAction")
    __properties: ClassVar[List[str]] = ["action", "caseNumber", "complaint", "contactId", "dateOfAction", "definition", "disciplinaryDecision", "entryDate", "information", "link", "note", "probationDate", "reinstatedDate", "rule", "ruleNumber", "sectionDate", "status", "stayDate", "supremeCourt", "term", "typeOfAction"]

    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 BarSourceDataDisciplinaryHistoryArrayInner 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 action (nullable) is None
        # and model_fields_set contains the field
        if self.action is None and "action" in self.model_fields_set:
            _dict['action'] = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "action": obj.get("action"),
            "caseNumber": obj.get("caseNumber"),
            "complaint": obj.get("complaint"),
            "contactId": obj.get("contactId"),
            "dateOfAction": obj.get("dateOfAction"),
            "definition": obj.get("definition"),
            "disciplinaryDecision": obj.get("disciplinaryDecision"),
            "entryDate": obj.get("entryDate"),
            "information": obj.get("information"),
            "link": obj.get("link"),
            "note": obj.get("note"),
            "probationDate": obj.get("probationDate"),
            "reinstatedDate": obj.get("reinstatedDate"),
            "rule": obj.get("rule"),
            "ruleNumber": obj.get("ruleNumber"),
            "sectionDate": obj.get("sectionDate"),
            "status": obj.get("status"),
            "stayDate": obj.get("stayDate"),
            "supremeCourt": obj.get("supremeCourt"),
            "term": obj.get("term"),
            "typeOfAction": obj.get("typeOfAction")
        })
        return _obj


