# 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, StrictInt
from typing import Any, ClassVar, Dict, List, Optional
from typing_extensions import Annotated
from unicourt.model.bar_source_data_administrative_actions_array_inner import BarSourceDataAdministrativeActionsArrayInner
from unicourt.model.bar_source_data_advanced_degree_array_inner import BarSourceDataAdvancedDegreeArrayInner
from unicourt.model.bar_source_data_bar_status_array_inner import BarSourceDataBarStatusArrayInner
from unicourt.model.bar_source_data_board_certifications_array_inner import BarSourceDataBoardCertificationsArrayInner
from unicourt.model.bar_source_data_committees_array_inner import BarSourceDataCommitteesArrayInner
from unicourt.model.bar_source_data_court_history_array_inner import BarSourceDataCourtHistoryArrayInner
from unicourt.model.bar_source_data_court_of_admissions import BarSourceDataCourtOfAdmissions
from unicourt.model.bar_source_data_disciplinary_history_array_inner import BarSourceDataDisciplinaryHistoryArrayInner
from unicourt.model.bar_source_data_discipline_summaries_array_inner import BarSourceDataDisciplineSummariesArrayInner
from unicourt.model.bar_source_data_employment_history_array_inner import BarSourceDataEmploymentHistoryArrayInner
from unicourt.model.bar_source_data_fees_options_array_inner import BarSourceDataFeesOptionsArrayInner
from unicourt.model.bar_source_data_involvements_array_inner import BarSourceDataInvolvementsArrayInner
from unicourt.model.bar_source_data_law_school_array_inner import BarSourceDataLawSchoolArrayInner
from unicourt.model.bar_source_data_name import BarSourceDataName
from unicourt.model.bar_source_data_open_action_status_array_inner import BarSourceDataOpenActionStatusArrayInner
from unicourt.model.bar_source_data_other_jurisdiction_array_inner import BarSourceDataOtherJurisdictionArrayInner
from unicourt.model.bar_source_data_public_hearing_array_inner import BarSourceDataPublicHearingArrayInner
from unicourt.model.bar_source_data_reason_for_inactivation import BarSourceDataReasonForInactivation
from unicourt.model.bar_source_data_related_cases_array_inner import BarSourceDataRelatedCasesArrayInner
from unicourt.model.bar_source_data_source_info import BarSourceDataSourceInfo
from unicourt.model.bar_source_data_statewide_grievance_committee_history_array_inner import BarSourceDataStatewideGrievanceCommitteeHistoryArrayInner
from unicourt.model.bar_source_data_status_history_array_inner import BarSourceDataStatusHistoryArrayInner
from unicourt.model.bar_source_data_ten_year_discipline_array_inner import BarSourceDataTenYearDisciplineArrayInner
from typing import Optional, Set
from typing_extensions import Self

class BarSourceData(BaseModel):
    """
    BarSourceData
    """ # noqa: E501
    object: Optional[Annotated[str, Field(strict=True, max_length=13)]] = 'BarSourceData'
    administrative_actions_array: Optional[List[BarSourceDataAdministrativeActionsArrayInner]] = Field(default=None, alias="administrativeActionsArray")
    admission_type: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="admissionType")
    appellate_court_district: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="appellateCourtDistrict")
    appellate_division_department: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="appellateDivisionDepartment")
    attorney_group: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="attorneyGroup")
    authorized: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    bar_service_class: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="barServiceClass")
    bio: Optional[Annotated[str, Field(strict=True, max_length=5000)]] = None
    board_certifications_array: Optional[List[BarSourceDataBoardCertificationsArrayInner]] = Field(default=None, alias="boardCertificationsArray")
    board_district: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="boardDistrict")
    circuit: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    comments: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    committees_array: Optional[List[BarSourceDataCommitteesArrayInner]] = Field(default=None, alias="committeesArray")
    court_history_array: Optional[List[BarSourceDataCourtHistoryArrayInner]] = Field(default=None, alias="courtHistoryArray")
    court_of_admissions: Optional[BarSourceDataCourtOfAdmissions] = Field(default=None, alias="courtOfAdmissions")
    court_service_email: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="courtServiceEmail")
    disciplinary_history_array: Optional[List[BarSourceDataDisciplinaryHistoryArrayInner]] = Field(default=None, alias="disciplinaryHistoryArray")
    discipline_summaries_array: Optional[List[BarSourceDataDisciplineSummariesArrayInner]] = Field(default=None, alias="disciplineSummariesArray")
    dismissals_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="dismissalsArray")
    district: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    employment_history_array: Optional[List[BarSourceDataEmploymentHistoryArrayInner]] = Field(default=None, alias="employmentHistoryArray")
    expiration_date: Optional[datetime] = Field(default=None, alias="expirationDate")
    fees_options_array: Optional[List[BarSourceDataFeesOptionsArrayInner]] = Field(default=None, alias="feesOptionsArray")
    firm_size: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="firmSize")
    firm_website: Optional[Annotated[str, Field(strict=True, max_length=1000)]] = Field(default=None, alias="firmWebsite")
    first_admitted_date: Optional[datetime] = Field(default=None, description="The firstAdmittedDate is the date when an attorney was admitted to the bar for the very first time regardless of which U.S state.", alias="firstAdmittedDate")
    first_admitted_year: Optional[StrictInt] = Field(default=None, alias="firstAdmittedYear")
    home_county: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="homeCounty")
    in_good_standing: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="inGoodStanding")
    insurance: Optional[Annotated[str, Field(strict=True, max_length=500)]] = None
    involvements_array: Optional[List[BarSourceDataInvolvementsArrayInner]] = Field(default=None, alias="involvementsArray")
    judicial_district: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="judicialDistrict")
    juris_type: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="jurisType")
    languages_array: Optional[List[Annotated[str, Field(strict=True, max_length=1000)]]] = Field(default=None, alias="languagesArray")
    last_renewal_date: Optional[datetime] = Field(default=None, alias="lastRenewalDate")
    law_school_array: Optional[List[BarSourceDataLawSchoolArrayInner]] = Field(default=None, alias="lawSchoolArray")
    legal_speciality_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="legalSpecialityArray")
    license_type: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="licenseType")
    name: Optional[BarSourceDataName] = None
    next_registration: Optional[datetime] = Field(default=None, alias="nextRegistration")
    next_renewal_date: Optional[datetime] = Field(default=None, alias="nextRenewalDate")
    open_action_status_array: Optional[List[BarSourceDataOpenActionStatusArrayInner]] = Field(default=None, alias="openActionStatusArray")
    other_jurisdiction_array: Optional[List[BarSourceDataOtherJurisdictionArrayInner]] = Field(default=None, alias="otherJurisdictionArray")
    other_name_array: Optional[List[Annotated[str, Field(strict=True, max_length=500)]]] = Field(default=None, alias="otherNameArray")
    parish: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    pending_proceeding_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="pendingProceedingArray")
    position: Optional[Annotated[str, Field(strict=True, max_length=250)]] = None
    practice_area_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="practiceAreaArray")
    practice_location_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="practiceLocationArray")
    private_law_practice: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="privateLawPractice")
    profile_last_certified: Optional[datetime] = Field(default=None, alias="profileLastCertified")
    public_hearing_array: Optional[List[BarSourceDataPublicHearingArrayInner]] = Field(default=None, alias="publicHearingArray")
    reason_for_inactivation: Optional[BarSourceDataReasonForInactivation] = Field(default=None, alias="reasonForInactivation")
    sections_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="sectionsArray")
    services_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="servicesArray")
    source_info: Optional[BarSourceDataSourceInfo] = Field(default=None, alias="sourceInfo")
    statewide_grievance_committee_history_array: Optional[List[BarSourceDataStatewideGrievanceCommitteeHistoryArrayInner]] = Field(default=None, alias="statewideGrievanceCommitteeHistoryArray")
    status: Optional[Annotated[str, Field(strict=True, max_length=500)]] = None
    status_date: Optional[datetime] = Field(default=None, alias="statusDate")
    status_history_array: Optional[List[BarSourceDataStatusHistoryArrayInner]] = Field(default=None, alias="statusHistoryArray")
    ten_year_discipline_array: Optional[List[BarSourceDataTenYearDisciplineArrayInner]] = Field(default=None, alias="tenYearDisciplineArray")
    undergraduate_school: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="undergraduateSchool")
    bar_law_firm: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="barLawFirm")
    years_of_practice: Optional[Annotated[str, Field(strict=True, max_length=250)]] = Field(default=None, alias="yearsOfPractice")
    clients_represented_array: Optional[List[Annotated[str, Field(strict=True, max_length=250)]]] = Field(default=None, alias="clientsRepresentedArray")
    status_hint: Optional[Annotated[str, Field(strict=True, max_length=500)]] = Field(default=None, alias="statusHint")
    advanced_degree_array: Optional[List[BarSourceDataAdvancedDegreeArrayInner]] = Field(default=None, alias="advancedDegreeArray")
    bar_status_array: Optional[List[BarSourceDataBarStatusArrayInner]] = Field(default=None, alias="barStatusArray")
    related_cases_array: Optional[List[BarSourceDataRelatedCasesArrayInner]] = Field(default=None, alias="relatedCasesArray")
    __properties: ClassVar[List[str]] = ["object", "administrativeActionsArray", "admissionType", "appellateCourtDistrict", "appellateDivisionDepartment", "attorneyGroup", "authorized", "barServiceClass", "bio", "boardCertificationsArray", "boardDistrict", "circuit", "comments", "committeesArray", "courtHistoryArray", "courtOfAdmissions", "courtServiceEmail", "disciplinaryHistoryArray", "disciplineSummariesArray", "dismissalsArray", "district", "employmentHistoryArray", "expirationDate", "feesOptionsArray", "firmSize", "firmWebsite", "firstAdmittedDate", "firstAdmittedYear", "homeCounty", "inGoodStanding", "insurance", "involvementsArray", "judicialDistrict", "jurisType", "languagesArray", "lastRenewalDate", "lawSchoolArray", "legalSpecialityArray", "licenseType", "name", "nextRegistration", "nextRenewalDate", "openActionStatusArray", "otherJurisdictionArray", "otherNameArray", "parish", "pendingProceedingArray", "position", "practiceAreaArray", "practiceLocationArray", "privateLawPractice", "profileLastCertified", "publicHearingArray", "reasonForInactivation", "sectionsArray", "servicesArray", "sourceInfo", "statewideGrievanceCommitteeHistoryArray", "status", "statusDate", "statusHistoryArray", "tenYearDisciplineArray", "undergraduateSchool", "barLawFirm", "yearsOfPractice", "clientsRepresentedArray", "statusHint", "advancedDegreeArray", "barStatusArray", "relatedCasesArray"]

    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 BarSourceData 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 administrative_actions_array (list)
        _items = []
        if self.administrative_actions_array:
            for _item in self.administrative_actions_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['administrativeActionsArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in board_certifications_array (list)
        _items = []
        if self.board_certifications_array:
            for _item in self.board_certifications_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['boardCertificationsArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in committees_array (list)
        _items = []
        if self.committees_array:
            for _item in self.committees_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['committeesArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in court_history_array (list)
        _items = []
        if self.court_history_array:
            for _item in self.court_history_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['courtHistoryArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of court_of_admissions
        if self.court_of_admissions:
            _dict['courtOfAdmissions'] = self.court_of_admissions.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in disciplinary_history_array (list)
        _items = []
        if self.disciplinary_history_array:
            for _item in self.disciplinary_history_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['disciplinaryHistoryArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in discipline_summaries_array (list)
        _items = []
        if self.discipline_summaries_array:
            for _item in self.discipline_summaries_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['disciplineSummariesArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in employment_history_array (list)
        _items = []
        if self.employment_history_array:
            for _item in self.employment_history_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['employmentHistoryArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in fees_options_array (list)
        _items = []
        if self.fees_options_array:
            for _item in self.fees_options_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['feesOptionsArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in involvements_array (list)
        _items = []
        if self.involvements_array:
            for _item in self.involvements_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['involvementsArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in law_school_array (list)
        _items = []
        if self.law_school_array:
            for _item in self.law_school_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['lawSchoolArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of name
        if self.name:
            _dict['name'] = self.name.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in open_action_status_array (list)
        _items = []
        if self.open_action_status_array:
            for _item in self.open_action_status_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['openActionStatusArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in other_jurisdiction_array (list)
        _items = []
        if self.other_jurisdiction_array:
            for _item in self.other_jurisdiction_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['otherJurisdictionArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in public_hearing_array (list)
        _items = []
        if self.public_hearing_array:
            for _item in self.public_hearing_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['publicHearingArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of reason_for_inactivation
        if self.reason_for_inactivation:
            _dict['reasonForInactivation'] = self.reason_for_inactivation.to_dict()
        # override the default output from pydantic by calling `to_dict()` of source_info
        if self.source_info:
            _dict['sourceInfo'] = self.source_info.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each item in statewide_grievance_committee_history_array (list)
        _items = []
        if self.statewide_grievance_committee_history_array:
            for _item in self.statewide_grievance_committee_history_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['statewideGrievanceCommitteeHistoryArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in status_history_array (list)
        _items = []
        if self.status_history_array:
            for _item in self.status_history_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['statusHistoryArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in ten_year_discipline_array (list)
        _items = []
        if self.ten_year_discipline_array:
            for _item in self.ten_year_discipline_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['tenYearDisciplineArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in advanced_degree_array (list)
        _items = []
        if self.advanced_degree_array:
            for _item in self.advanced_degree_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['advancedDegreeArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in bar_status_array (list)
        _items = []
        if self.bar_status_array:
            for _item in self.bar_status_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['barStatusArray'] = _items
        # override the default output from pydantic by calling `to_dict()` of each item in related_cases_array (list)
        _items = []
        if self.related_cases_array:
            for _item in self.related_cases_array:
                if _item:
                    _items.append(_item.to_dict())
            _dict['relatedCasesArray'] = _items
        # set to None if admission_type (nullable) is None
        # and model_fields_set contains the field
        if self.admission_type is None and "admission_type" in self.model_fields_set:
            _dict['admissionType'] = None

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "object": obj.get("object") if obj.get("object") is not None else 'BarSourceData',
            "administrativeActionsArray": [BarSourceDataAdministrativeActionsArrayInner.from_dict(_item) for _item in obj["administrativeActionsArray"]] if obj.get("administrativeActionsArray") is not None else None,
            "admissionType": obj.get("admissionType"),
            "appellateCourtDistrict": obj.get("appellateCourtDistrict"),
            "appellateDivisionDepartment": obj.get("appellateDivisionDepartment"),
            "attorneyGroup": obj.get("attorneyGroup"),
            "authorized": obj.get("authorized"),
            "barServiceClass": obj.get("barServiceClass"),
            "bio": obj.get("bio"),
            "boardCertificationsArray": [BarSourceDataBoardCertificationsArrayInner.from_dict(_item) for _item in obj["boardCertificationsArray"]] if obj.get("boardCertificationsArray") is not None else None,
            "boardDistrict": obj.get("boardDistrict"),
            "circuit": obj.get("circuit"),
            "comments": obj.get("comments"),
            "committeesArray": [BarSourceDataCommitteesArrayInner.from_dict(_item) for _item in obj["committeesArray"]] if obj.get("committeesArray") is not None else None,
            "courtHistoryArray": [BarSourceDataCourtHistoryArrayInner.from_dict(_item) for _item in obj["courtHistoryArray"]] if obj.get("courtHistoryArray") is not None else None,
            "courtOfAdmissions": BarSourceDataCourtOfAdmissions.from_dict(obj["courtOfAdmissions"]) if obj.get("courtOfAdmissions") is not None else None,
            "courtServiceEmail": obj.get("courtServiceEmail"),
            "disciplinaryHistoryArray": [BarSourceDataDisciplinaryHistoryArrayInner.from_dict(_item) for _item in obj["disciplinaryHistoryArray"]] if obj.get("disciplinaryHistoryArray") is not None else None,
            "disciplineSummariesArray": [BarSourceDataDisciplineSummariesArrayInner.from_dict(_item) for _item in obj["disciplineSummariesArray"]] if obj.get("disciplineSummariesArray") is not None else None,
            "dismissalsArray": obj.get("dismissalsArray"),
            "district": obj.get("district"),
            "employmentHistoryArray": [BarSourceDataEmploymentHistoryArrayInner.from_dict(_item) for _item in obj["employmentHistoryArray"]] if obj.get("employmentHistoryArray") is not None else None,
            "expirationDate": obj.get("expirationDate"),
            "feesOptionsArray": [BarSourceDataFeesOptionsArrayInner.from_dict(_item) for _item in obj["feesOptionsArray"]] if obj.get("feesOptionsArray") is not None else None,
            "firmSize": obj.get("firmSize"),
            "firmWebsite": obj.get("firmWebsite"),
            "firstAdmittedDate": obj.get("firstAdmittedDate"),
            "firstAdmittedYear": obj.get("firstAdmittedYear"),
            "homeCounty": obj.get("homeCounty"),
            "inGoodStanding": obj.get("inGoodStanding"),
            "insurance": obj.get("insurance"),
            "involvementsArray": [BarSourceDataInvolvementsArrayInner.from_dict(_item) for _item in obj["involvementsArray"]] if obj.get("involvementsArray") is not None else None,
            "judicialDistrict": obj.get("judicialDistrict"),
            "jurisType": obj.get("jurisType"),
            "languagesArray": obj.get("languagesArray"),
            "lastRenewalDate": obj.get("lastRenewalDate"),
            "lawSchoolArray": [BarSourceDataLawSchoolArrayInner.from_dict(_item) for _item in obj["lawSchoolArray"]] if obj.get("lawSchoolArray") is not None else None,
            "legalSpecialityArray": obj.get("legalSpecialityArray"),
            "licenseType": obj.get("licenseType"),
            "name": BarSourceDataName.from_dict(obj["name"]) if obj.get("name") is not None else None,
            "nextRegistration": obj.get("nextRegistration"),
            "nextRenewalDate": obj.get("nextRenewalDate"),
            "openActionStatusArray": [BarSourceDataOpenActionStatusArrayInner.from_dict(_item) for _item in obj["openActionStatusArray"]] if obj.get("openActionStatusArray") is not None else None,
            "otherJurisdictionArray": [BarSourceDataOtherJurisdictionArrayInner.from_dict(_item) for _item in obj["otherJurisdictionArray"]] if obj.get("otherJurisdictionArray") is not None else None,
            "otherNameArray": obj.get("otherNameArray"),
            "parish": obj.get("parish"),
            "pendingProceedingArray": obj.get("pendingProceedingArray"),
            "position": obj.get("position"),
            "practiceAreaArray": obj.get("practiceAreaArray"),
            "practiceLocationArray": obj.get("practiceLocationArray"),
            "privateLawPractice": obj.get("privateLawPractice"),
            "profileLastCertified": obj.get("profileLastCertified"),
            "publicHearingArray": [BarSourceDataPublicHearingArrayInner.from_dict(_item) for _item in obj["publicHearingArray"]] if obj.get("publicHearingArray") is not None else None,
            "reasonForInactivation": BarSourceDataReasonForInactivation.from_dict(obj["reasonForInactivation"]) if obj.get("reasonForInactivation") is not None else None,
            "sectionsArray": obj.get("sectionsArray"),
            "servicesArray": obj.get("servicesArray"),
            "sourceInfo": BarSourceDataSourceInfo.from_dict(obj["sourceInfo"]) if obj.get("sourceInfo") is not None else None,
            "statewideGrievanceCommitteeHistoryArray": [BarSourceDataStatewideGrievanceCommitteeHistoryArrayInner.from_dict(_item) for _item in obj["statewideGrievanceCommitteeHistoryArray"]] if obj.get("statewideGrievanceCommitteeHistoryArray") is not None else None,
            "status": obj.get("status"),
            "statusDate": obj.get("statusDate"),
            "statusHistoryArray": [BarSourceDataStatusHistoryArrayInner.from_dict(_item) for _item in obj["statusHistoryArray"]] if obj.get("statusHistoryArray") is not None else None,
            "tenYearDisciplineArray": [BarSourceDataTenYearDisciplineArrayInner.from_dict(_item) for _item in obj["tenYearDisciplineArray"]] if obj.get("tenYearDisciplineArray") is not None else None,
            "undergraduateSchool": obj.get("undergraduateSchool"),
            "barLawFirm": obj.get("barLawFirm"),
            "yearsOfPractice": obj.get("yearsOfPractice"),
            "clientsRepresentedArray": obj.get("clientsRepresentedArray"),
            "statusHint": obj.get("statusHint"),
            "advancedDegreeArray": [BarSourceDataAdvancedDegreeArrayInner.from_dict(_item) for _item in obj["advancedDegreeArray"]] if obj.get("advancedDegreeArray") is not None else None,
            "barStatusArray": [BarSourceDataBarStatusArrayInner.from_dict(_item) for _item in obj["barStatusArray"]] if obj.get("barStatusArray") is not None else None,
            "relatedCasesArray": [BarSourceDataRelatedCasesArrayInner.from_dict(_item) for _item in obj["relatedCasesArray"]] if obj.get("relatedCasesArray") is not None else None
        })
        return _obj


