# coding: utf-8

"""
    SmartyMeet Dev03 API REST

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

    The version of the OpenAPI document: 1.0.1
    Contact: developer@smartymeet.com
    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, StrictInt, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from smartytalent_client.models.candidate_criteria_schema import CandidateCriteriaSchema
from smartytalent_client.models.resource_timestamps_schema import ResourceTimestampsSchema
from smartytalent_client.models.talent_alumni_schema import TalentAlumniSchema
from smartytalent_client.models.talent_referral_schema import TalentReferralSchema
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class CandidateAttributesSchema(BaseModel):
    """
    CandidateAttributesSchema
    """ # noqa: E501
    name: StrictStr = Field(description="Full name of the candidate")
    email: StrictStr = Field(description="Primary email address")
    secondary_email: Optional[StrictStr] = Field(default=None, description="Secondary email address", alias="secondaryEmail")
    work_email: Optional[StrictStr] = Field(default=None, description="Work email address", alias="workEmail")
    phone: Optional[StrictStr] = Field(default=None, description="Primary phone number")
    work_phone: Optional[StrictStr] = Field(default=None, description="Work phone number", alias="workPhone")
    status: Optional[StrictStr] = Field(default=None, description="Current status of the candidate")
    stage: Optional[StrictStr] = Field(default=None, description="Current stage in the recruitment pipeline")
    age: Optional[StrictStr] = Field(default=None, description="Candidate age")
    gender: Optional[StrictStr] = Field(default=None, description="Candidate gender")
    source: Optional[StrictStr] = Field(default=None, description="Source of the candidate (e.g., referral, job board)")
    short_code: Optional[StrictStr] = Field(default=None, description="Short code identifier for the candidate", alias="shortCode")
    language_code: Optional[StrictStr] = Field(default=None, description="Preferred language code (e.g., en-US, pl-PL)", alias="languageCode")
    recommendation_status_code: Optional[StrictInt] = Field(default=None, description="Numeric recommendation status code", alias="recommendationStatusCode")
    overall_match_rating: Optional[StrictInt] = Field(default=None, description="Overall match rating (0-5)", alias="overallMatchRating")
    prev_overall_match_rating: Optional[StrictInt] = Field(default=None, description="Previous overall match rating before recalculation", alias="prevOverallMatchRating")
    ttl: Optional[StrictStr] = Field(default=None, description="Time-to-live expiration timestamp")
    timestamps: Optional[ResourceTimestampsSchema] = None
    alumni: Optional[TalentAlumniSchema] = None
    referral: Optional[TalentReferralSchema] = None
    job_position_title: Optional[Dict[str, StrictStr]] = Field(default=None, description="Language-keyed job position title", alias="jobPositionTitle")
    rejection_ticket: Optional[Dict[str, StrictStr]] = Field(default=None, description="Language-keyed rejection ticket text", alias="rejectionTicket")
    recommendation_status: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="Language-keyed recommendation status", alias="recommendationStatus")
    overall_assessment: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="Language-keyed overall assessment", alias="overallAssessment")
    next_steps: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="Language-keyed next steps recommendations", alias="nextSteps")
    insights_and_analysis: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="Language-keyed insights and analysis", alias="insightsAndAnalysis")
    keywords: Optional[Dict[str, Dict[str, Any]]] = Field(default=None, description="Language-keyed extracted keywords")
    availability: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed availability criteria")
    certifications: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed certifications criteria")
    company_type_experience: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed company type experience criteria", alias="companyTypeExperience")
    education: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed education criteria")
    experience_and_seniority: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed experience and seniority criteria", alias="experienceAndSeniority")
    industry_experience: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed industry experience criteria", alias="industryExperience")
    job_positions: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed job positions criteria", alias="jobPositions")
    job_tendencies: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed job tendencies criteria", alias="jobTendencies")
    languages_spoken: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed languages spoken criteria", alias="languagesSpoken")
    licenses: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed licenses criteria")
    location_preferences: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed location preferences criteria", alias="locationPreferences")
    personality_and_soft_skills: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed personality and soft skills criteria", alias="personalityAndSoftSkills")
    salary_expectation: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed salary expectation criteria", alias="salaryExpectation")
    skills_and_expertise: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed skills and expertise criteria", alias="skillsAndExpertise")
    work_authorization: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed work authorization criteria", alias="workAuthorization")
    work_preferences: Optional[Dict[str, CandidateCriteriaSchema]] = Field(default=None, description="Language-keyed work preferences criteria", alias="workPreferences")
    __properties: ClassVar[List[str]] = ["name", "email", "secondaryEmail", "workEmail", "phone", "workPhone", "status", "stage", "age", "gender", "source", "shortCode", "languageCode", "recommendationStatusCode", "overallMatchRating", "prevOverallMatchRating", "ttl", "timestamps", "alumni", "referral", "jobPositionTitle", "rejectionTicket", "recommendationStatus", "overallAssessment", "nextSteps", "insightsAndAnalysis", "keywords", "availability", "certifications", "companyTypeExperience", "education", "experienceAndSeniority", "industryExperience", "jobPositions", "jobTendencies", "languagesSpoken", "licenses", "locationPreferences", "personalityAndSoftSkills", "salaryExpectation", "skillsAndExpertise", "workAuthorization", "workPreferences"]

    @field_validator('status')
    def status_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['active', 'withdrawn', 'rejected', 'inactive', 'onHold', 'offerExtended', 'offerDeclined', 'futureConsideration', 'archived']):
            raise ValueError("must be one of enum values ('active', 'withdrawn', 'rejected', 'inactive', 'onHold', 'offerExtended', 'offerDeclined', 'futureConsideration', 'archived')")
        return value

    @field_validator('stage')
    def stage_validate_enum(cls, value):
        """Validates the enum"""
        if value is None:
            return value

        if value not in set(['sourced', 'applied', 'initial', 'prescreened', 'screened', 'assessed', 'contacted', 'interviewed', 'offered', 'hired', 'onboarded', 'evaluated']):
            raise ValueError("must be one of enum values ('sourced', 'applied', 'initial', 'prescreened', 'screened', 'assessed', 'contacted', 'interviewed', 'offered', 'hired', 'onboarded', 'evaluated')")
        return value

    model_config = ConfigDict(
        validate_by_name=True,
        validate_by_alias=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"""
        return json.dumps(to_jsonable_python(self.to_dict()))

    @classmethod
    def from_json(cls, json_str: str) -> Optional[Self]:
        """Create an instance of CandidateAttributesSchema 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 timestamps
        if self.timestamps:
            _dict['timestamps'] = self.timestamps.to_dict()
        # override the default output from pydantic by calling `to_dict()` of alumni
        if self.alumni:
            _dict['alumni'] = self.alumni.to_dict()
        # override the default output from pydantic by calling `to_dict()` of referral
        if self.referral:
            _dict['referral'] = self.referral.to_dict()
        # override the default output from pydantic by calling `to_dict()` of each value in availability (dict)
        _field_dict = {}
        if self.availability:
            for _key_availability in self.availability:
                if self.availability[_key_availability]:
                    _field_dict[_key_availability] = self.availability[_key_availability].to_dict()
            _dict['availability'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in certifications (dict)
        _field_dict = {}
        if self.certifications:
            for _key_certifications in self.certifications:
                if self.certifications[_key_certifications]:
                    _field_dict[_key_certifications] = self.certifications[_key_certifications].to_dict()
            _dict['certifications'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in company_type_experience (dict)
        _field_dict = {}
        if self.company_type_experience:
            for _key_company_type_experience in self.company_type_experience:
                if self.company_type_experience[_key_company_type_experience]:
                    _field_dict[_key_company_type_experience] = self.company_type_experience[_key_company_type_experience].to_dict()
            _dict['companyTypeExperience'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in education (dict)
        _field_dict = {}
        if self.education:
            for _key_education in self.education:
                if self.education[_key_education]:
                    _field_dict[_key_education] = self.education[_key_education].to_dict()
            _dict['education'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in experience_and_seniority (dict)
        _field_dict = {}
        if self.experience_and_seniority:
            for _key_experience_and_seniority in self.experience_and_seniority:
                if self.experience_and_seniority[_key_experience_and_seniority]:
                    _field_dict[_key_experience_and_seniority] = self.experience_and_seniority[_key_experience_and_seniority].to_dict()
            _dict['experienceAndSeniority'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in industry_experience (dict)
        _field_dict = {}
        if self.industry_experience:
            for _key_industry_experience in self.industry_experience:
                if self.industry_experience[_key_industry_experience]:
                    _field_dict[_key_industry_experience] = self.industry_experience[_key_industry_experience].to_dict()
            _dict['industryExperience'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in job_positions (dict)
        _field_dict = {}
        if self.job_positions:
            for _key_job_positions in self.job_positions:
                if self.job_positions[_key_job_positions]:
                    _field_dict[_key_job_positions] = self.job_positions[_key_job_positions].to_dict()
            _dict['jobPositions'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in job_tendencies (dict)
        _field_dict = {}
        if self.job_tendencies:
            for _key_job_tendencies in self.job_tendencies:
                if self.job_tendencies[_key_job_tendencies]:
                    _field_dict[_key_job_tendencies] = self.job_tendencies[_key_job_tendencies].to_dict()
            _dict['jobTendencies'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in languages_spoken (dict)
        _field_dict = {}
        if self.languages_spoken:
            for _key_languages_spoken in self.languages_spoken:
                if self.languages_spoken[_key_languages_spoken]:
                    _field_dict[_key_languages_spoken] = self.languages_spoken[_key_languages_spoken].to_dict()
            _dict['languagesSpoken'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in licenses (dict)
        _field_dict = {}
        if self.licenses:
            for _key_licenses in self.licenses:
                if self.licenses[_key_licenses]:
                    _field_dict[_key_licenses] = self.licenses[_key_licenses].to_dict()
            _dict['licenses'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in location_preferences (dict)
        _field_dict = {}
        if self.location_preferences:
            for _key_location_preferences in self.location_preferences:
                if self.location_preferences[_key_location_preferences]:
                    _field_dict[_key_location_preferences] = self.location_preferences[_key_location_preferences].to_dict()
            _dict['locationPreferences'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in personality_and_soft_skills (dict)
        _field_dict = {}
        if self.personality_and_soft_skills:
            for _key_personality_and_soft_skills in self.personality_and_soft_skills:
                if self.personality_and_soft_skills[_key_personality_and_soft_skills]:
                    _field_dict[_key_personality_and_soft_skills] = self.personality_and_soft_skills[_key_personality_and_soft_skills].to_dict()
            _dict['personalityAndSoftSkills'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in salary_expectation (dict)
        _field_dict = {}
        if self.salary_expectation:
            for _key_salary_expectation in self.salary_expectation:
                if self.salary_expectation[_key_salary_expectation]:
                    _field_dict[_key_salary_expectation] = self.salary_expectation[_key_salary_expectation].to_dict()
            _dict['salaryExpectation'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in skills_and_expertise (dict)
        _field_dict = {}
        if self.skills_and_expertise:
            for _key_skills_and_expertise in self.skills_and_expertise:
                if self.skills_and_expertise[_key_skills_and_expertise]:
                    _field_dict[_key_skills_and_expertise] = self.skills_and_expertise[_key_skills_and_expertise].to_dict()
            _dict['skillsAndExpertise'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in work_authorization (dict)
        _field_dict = {}
        if self.work_authorization:
            for _key_work_authorization in self.work_authorization:
                if self.work_authorization[_key_work_authorization]:
                    _field_dict[_key_work_authorization] = self.work_authorization[_key_work_authorization].to_dict()
            _dict['workAuthorization'] = _field_dict
        # override the default output from pydantic by calling `to_dict()` of each value in work_preferences (dict)
        _field_dict = {}
        if self.work_preferences:
            for _key_work_preferences in self.work_preferences:
                if self.work_preferences[_key_work_preferences]:
                    _field_dict[_key_work_preferences] = self.work_preferences[_key_work_preferences].to_dict()
            _dict['workPreferences'] = _field_dict
        # set to None if age (nullable) is None
        # and model_fields_set contains the field
        if self.age is None and "age" in self.model_fields_set:
            _dict['age'] = None

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

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

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

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

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

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

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

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

        return _dict

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

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

        _obj = cls.model_validate({
            "name": obj.get("name"),
            "email": obj.get("email"),
            "secondaryEmail": obj.get("secondaryEmail"),
            "workEmail": obj.get("workEmail"),
            "phone": obj.get("phone"),
            "workPhone": obj.get("workPhone"),
            "status": obj.get("status"),
            "stage": obj.get("stage"),
            "age": obj.get("age"),
            "gender": obj.get("gender"),
            "source": obj.get("source"),
            "shortCode": obj.get("shortCode"),
            "languageCode": obj.get("languageCode"),
            "recommendationStatusCode": obj.get("recommendationStatusCode"),
            "overallMatchRating": obj.get("overallMatchRating"),
            "prevOverallMatchRating": obj.get("prevOverallMatchRating"),
            "ttl": obj.get("ttl"),
            "timestamps": ResourceTimestampsSchema.from_dict(obj["timestamps"]) if obj.get("timestamps") is not None else None,
            "alumni": TalentAlumniSchema.from_dict(obj["alumni"]) if obj.get("alumni") is not None else None,
            "referral": TalentReferralSchema.from_dict(obj["referral"]) if obj.get("referral") is not None else None,
            "jobPositionTitle": obj.get("jobPositionTitle"),
            "rejectionTicket": obj.get("rejectionTicket"),
            "recommendationStatus": obj.get("recommendationStatus"),
            "overallAssessment": obj.get("overallAssessment"),
            "nextSteps": obj.get("nextSteps"),
            "insightsAndAnalysis": obj.get("insightsAndAnalysis"),
            "keywords": obj.get("keywords"),
            "availability": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["availability"].items()
            )
            if obj.get("availability") is not None
            else None,
            "certifications": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["certifications"].items()
            )
            if obj.get("certifications") is not None
            else None,
            "companyTypeExperience": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["companyTypeExperience"].items()
            )
            if obj.get("companyTypeExperience") is not None
            else None,
            "education": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["education"].items()
            )
            if obj.get("education") is not None
            else None,
            "experienceAndSeniority": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["experienceAndSeniority"].items()
            )
            if obj.get("experienceAndSeniority") is not None
            else None,
            "industryExperience": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["industryExperience"].items()
            )
            if obj.get("industryExperience") is not None
            else None,
            "jobPositions": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["jobPositions"].items()
            )
            if obj.get("jobPositions") is not None
            else None,
            "jobTendencies": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["jobTendencies"].items()
            )
            if obj.get("jobTendencies") is not None
            else None,
            "languagesSpoken": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["languagesSpoken"].items()
            )
            if obj.get("languagesSpoken") is not None
            else None,
            "licenses": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["licenses"].items()
            )
            if obj.get("licenses") is not None
            else None,
            "locationPreferences": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["locationPreferences"].items()
            )
            if obj.get("locationPreferences") is not None
            else None,
            "personalityAndSoftSkills": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["personalityAndSoftSkills"].items()
            )
            if obj.get("personalityAndSoftSkills") is not None
            else None,
            "salaryExpectation": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["salaryExpectation"].items()
            )
            if obj.get("salaryExpectation") is not None
            else None,
            "skillsAndExpertise": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["skillsAndExpertise"].items()
            )
            if obj.get("skillsAndExpertise") is not None
            else None,
            "workAuthorization": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["workAuthorization"].items()
            )
            if obj.get("workAuthorization") is not None
            else None,
            "workPreferences": dict(
                (_k, CandidateCriteriaSchema.from_dict(_v))
                for _k, _v in obj["workPreferences"].items()
            )
            if obj.get("workPreferences") is not None
            else None
        })
        return _obj


