# 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, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from smartytalent_client.models.job_attributes_location_item_schema import JobAttributesLocationItemSchema
from smartytalent_client.models.job_attributes_organization_schema import JobAttributesOrganizationSchema
from smartytalent_client.models.job_attributes_settings_schema import JobAttributesSettingsSchema
from smartytalent_client.models.job_attributes_site_item_schema import JobAttributesSiteItemSchema
from smartytalent_client.models.job_criteria_schema import JobCriteriaSchema
from smartytalent_client.models.resource_timestamps_schema import ResourceTimestampsSchema
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class JobAttributesSchema(BaseModel):
    """
    JobAttributesSchema
    """ # noqa: E501
    title: Dict[str, StrictStr] = Field(description="The job title/position. Language-keyed object where keys are locale codes (e.g. en-US, pl-PL).")
    description: Optional[Dict[str, StrictStr]] = Field(default=None, description="Detailed job description. Language-keyed object.")
    short_code: Optional[StrictStr] = Field(default=None, description="Unique short identifier for the job", alias="shortCode")
    source: Optional[StrictStr] = Field(default=None, description="Source of the job posting (e.g. email, erecruiter)")
    language_code: Optional[StrictStr] = Field(default=None, description="Primary language code for the job posting (e.g. en-US, pl-PL)", alias="languageCode")
    status: Optional[StrictStr] = None
    timestamps: Optional[ResourceTimestampsSchema] = None
    department: Optional[Dict[str, StrictStr]] = Field(default=None, description="Department where the position is located. Language-keyed object.")
    specialization: Optional[Dict[str, StrictStr]] = Field(default=None, description="Job specialization area. Language-keyed object.")
    company_culture: Optional[StrictStr] = Field(default=None, description="Description of the company's culture and values", alias="companyCulture")
    seniority: Optional[StrictStr] = Field(default=None, description="Seniority level for the role (e.g. junior, mid, senior)")
    availability: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Availability criteria. Language-keyed object containing criteria with name, description, priority, comparisonRule and expected values.")
    responsibilities: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="List of job responsibilities. Language-keyed object where each language maps to an array of strings.")
    skills_and_expertise: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Technical skills and domain expertise criteria. Language-keyed object containing criteria with expected skills.", alias="skillsAndExpertise")
    languages_spoken: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Language proficiency requirements. Language-keyed object containing criteria with expected languages.", alias="languagesSpoken")
    work_preferences: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Work style and schedule preferences. Language-keyed object containing criteria.", alias="workPreferences")
    location_preferences: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Geographic location requirements. Language-keyed object containing criteria with expected locations.", alias="locationPreferences")
    industry_experience: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Industry sector experience requirements. Language-keyed object containing criteria.", alias="industryExperience")
    company_type_experience: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Company type experience requirements. Language-keyed object containing criteria.", alias="companyTypeExperience")
    job_positions: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Required previous job positions. Language-keyed object containing criteria.", alias="jobPositions")
    job_tendencies: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Career pattern and progression requirements. Language-keyed object containing criteria.", alias="jobTendencies")
    keywords: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="Relevant keywords for the position. Language-keyed object where each language maps to an array of strings.")
    work_authorization: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Work authorization requirements. Language-keyed object containing criteria.", alias="workAuthorization")
    certifications: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Professional certifications requirements. Language-keyed object containing criteria.")
    licenses: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Professional licenses requirements. Language-keyed object containing criteria.")
    personality_and_soft_skills: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Soft skills and personality trait requirements. Language-keyed object containing criteria.", alias="personalityAndSoftSkills")
    education: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Education requirements. Language-keyed object containing criteria.")
    experience_and_seniority: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Experience and seniority level requirements. Language-keyed object containing criteria.", alias="experienceAndSeniority")
    benefits: Optional[Dict[str, List[StrictStr]]] = Field(default=None, description="Job benefits. Language-keyed object where each language maps to an array of strings.")
    salary_expectation: Optional[Dict[str, JobCriteriaSchema]] = Field(default=None, description="Salary and compensation criteria. Language-keyed object containing criteria with expected salary ranges.", alias="salaryExpectation")
    locations: Optional[Dict[str, List[JobAttributesLocationItemSchema]]] = Field(default=None, description="Office locations for the job. Language-keyed object where each language maps to an array of location objects.")
    sites: Optional[Dict[str, List[JobAttributesSiteItemSchema]]] = Field(default=None, description="Work site types for the job. Language-keyed object where each language maps to an array of site objects.")
    organization: Optional[JobAttributesOrganizationSchema] = None
    settings: Optional[JobAttributesSettingsSchema] = None
    __properties: ClassVar[List[str]] = ["title", "description", "shortCode", "source", "languageCode", "status", "timestamps", "department", "specialization", "companyCulture", "seniority", "availability", "responsibilities", "skillsAndExpertise", "languagesSpoken", "workPreferences", "locationPreferences", "industryExperience", "companyTypeExperience", "jobPositions", "jobTendencies", "keywords", "workAuthorization", "certifications", "licenses", "personalityAndSoftSkills", "education", "experienceAndSeniority", "benefits", "salaryExpectation", "locations", "sites", "organization", "settings"]

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

        if value not in set(['active', 'inactive', 'draft', 'pending', 'archived', 'failed']):
            raise ValueError("must be one of enum values ('active', 'inactive', 'draft', 'pending', 'archived', 'failed')")
        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 JobAttributesSchema 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 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 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 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 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
        # 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 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 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 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 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 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 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 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 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 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 locations (dict of array)
        _field_dict_of_array = {}
        if self.locations:
            for _key_locations in self.locations:
                if self.locations[_key_locations] is not None:
                    _field_dict_of_array[_key_locations] = [
                        _item.to_dict() for _item in self.locations[_key_locations]
                    ]
            _dict['locations'] = _field_dict_of_array
        # override the default output from pydantic by calling `to_dict()` of each value in sites (dict of array)
        _field_dict_of_array = {}
        if self.sites:
            for _key_sites in self.sites:
                if self.sites[_key_sites] is not None:
                    _field_dict_of_array[_key_sites] = [
                        _item.to_dict() for _item in self.sites[_key_sites]
                    ]
            _dict['sites'] = _field_dict_of_array
        # override the default output from pydantic by calling `to_dict()` of organization
        if self.organization:
            _dict['organization'] = self.organization.to_dict()
        # override the default output from pydantic by calling `to_dict()` of settings
        if self.settings:
            _dict['settings'] = self.settings.to_dict()
        return _dict

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

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

        _obj = cls.model_validate({
            "title": obj.get("title"),
            "description": obj.get("description"),
            "shortCode": obj.get("shortCode"),
            "source": obj.get("source"),
            "languageCode": obj.get("languageCode"),
            "status": obj.get("status"),
            "timestamps": ResourceTimestampsSchema.from_dict(obj["timestamps"]) if obj.get("timestamps") is not None else None,
            "department": obj.get("department"),
            "specialization": obj.get("specialization"),
            "companyCulture": obj.get("companyCulture"),
            "seniority": obj.get("seniority"),
            "availability": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["availability"].items()
            )
            if obj.get("availability") is not None
            else None,
            "responsibilities": obj.get("responsibilities"),
            "skillsAndExpertise": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["skillsAndExpertise"].items()
            )
            if obj.get("skillsAndExpertise") is not None
            else None,
            "languagesSpoken": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["languagesSpoken"].items()
            )
            if obj.get("languagesSpoken") is not None
            else None,
            "workPreferences": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["workPreferences"].items()
            )
            if obj.get("workPreferences") is not None
            else None,
            "locationPreferences": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["locationPreferences"].items()
            )
            if obj.get("locationPreferences") is not None
            else None,
            "industryExperience": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["industryExperience"].items()
            )
            if obj.get("industryExperience") is not None
            else None,
            "companyTypeExperience": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["companyTypeExperience"].items()
            )
            if obj.get("companyTypeExperience") is not None
            else None,
            "jobPositions": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["jobPositions"].items()
            )
            if obj.get("jobPositions") is not None
            else None,
            "jobTendencies": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["jobTendencies"].items()
            )
            if obj.get("jobTendencies") is not None
            else None,
            "keywords": obj.get("keywords"),
            "workAuthorization": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["workAuthorization"].items()
            )
            if obj.get("workAuthorization") is not None
            else None,
            "certifications": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["certifications"].items()
            )
            if obj.get("certifications") is not None
            else None,
            "licenses": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["licenses"].items()
            )
            if obj.get("licenses") is not None
            else None,
            "personalityAndSoftSkills": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["personalityAndSoftSkills"].items()
            )
            if obj.get("personalityAndSoftSkills") is not None
            else None,
            "education": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["education"].items()
            )
            if obj.get("education") is not None
            else None,
            "experienceAndSeniority": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["experienceAndSeniority"].items()
            )
            if obj.get("experienceAndSeniority") is not None
            else None,
            "benefits": obj.get("benefits"),
            "salaryExpectation": dict(
                (_k, JobCriteriaSchema.from_dict(_v))
                for _k, _v in obj["salaryExpectation"].items()
            )
            if obj.get("salaryExpectation") is not None
            else None,
            "locations": dict(
                (_k,
                        [JobAttributesLocationItemSchema.from_dict(_item) for _item in _v]
                        if _v is not None
                        else None
                )
                for _k, _v in obj.get("locations", {}).items()
            ),
            "sites": dict(
                (_k,
                        [JobAttributesSiteItemSchema.from_dict(_item) for _item in _v]
                        if _v is not None
                        else None
                )
                for _k, _v in obj.get("sites", {}).items()
            ),
            "organization": JobAttributesOrganizationSchema.from_dict(obj["organization"]) if obj.get("organization") is not None else None,
            "settings": JobAttributesSettingsSchema.from_dict(obj["settings"]) if obj.get("settings") is not None else None
        })
        return _obj


