# 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.resource_timestamps_schema import ResourceTimestampsSchema
from typing import Optional, Set
from typing_extensions import Self
from pydantic_core import to_jsonable_python

class FinderAttributesSchema(BaseModel):
    """
    FinderAttributesSchema
    """ # noqa: E501
    name: StrictStr = Field(description="The name of the finder search")
    type: StrictStr = Field(description="The type of search to perform")
    query: Optional[Dict[str, Any]] = Field(default=None, description="Search query parameters sent to OpenSearch. Supported keys for talent search: Semantic (full-text match) - \"search\" (multi-match across all text fields), \"name\", \"quickInsights\", \"skillsAndExpertise\", \"professionalExperience\", \"education\", \"experienceAndSeniority\", \"jobPositions\", \"keywords\", \"certifications\", \"industryExperience\", \"languagesSpoken\", \"locationPreferences\", \"personalityAndSoftSkills\", \"availability\", \"workPreferences\", \"workAuthorization\". Filters (exact match) - \"status\", \"source\", \"email\", \"gender\", \"shortCode\", \"isTalentPool\", \"relocationWillingness\", \"requiresSponsorship\", \"careerBreak\". IDs - \"jobId\", \"talentId\".")
    results: Optional[Dict[str, Any]] = Field(default=None, description="The search results returned from OpenSearch (auto-populated)")
    status: Optional[StrictStr] = Field(default=None, description="The current status of the finder")
    language_code: Optional[StrictStr] = Field(default=None, description="Language code for the finder (default en)", alias="languageCode")
    settings: Optional[Dict[str, Any]] = Field(default=None, description="Additional configuration settings")
    source: Optional[StrictStr] = Field(default=None, description="Source of the finder creation")
    short_code: Optional[StrictStr] = Field(default=None, description="Unique short identifier", alias="shortCode")
    ttl: Optional[StrictStr] = Field(default=None, description="Time-to-live expiration timestamp (ISO 8601)")
    timestamps: Optional[ResourceTimestampsSchema] = None
    __properties: ClassVar[List[str]] = ["name", "type", "query", "results", "status", "languageCode", "settings", "source", "shortCode", "ttl", "timestamps"]

    @field_validator('type')
    def type_validate_enum(cls, value):
        """Validates the enum"""
        if value not in set(['talents', 'candidates', 'jobs', 'emails', 'users', 'reports']):
            raise ValueError("must be one of enum values ('talents', 'candidates', 'jobs', 'emails', 'users', 'reports')")
        return value

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

        if value not in set(['active', 'pending', 'completed', 'failed', 'archived']):
            raise ValueError("must be one of enum values ('active', 'pending', 'completed', 'failed', 'archived')")
        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 FinderAttributesSchema 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()
        # 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 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 FinderAttributesSchema 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"),
            "type": obj.get("type"),
            "query": obj.get("query"),
            "results": obj.get("results"),
            "status": obj.get("status"),
            "languageCode": obj.get("languageCode"),
            "settings": obj.get("settings"),
            "source": obj.get("source"),
            "shortCode": obj.get("shortCode"),
            "ttl": obj.get("ttl"),
            "timestamps": ResourceTimestampsSchema.from_dict(obj["timestamps"]) if obj.get("timestamps") is not None else None
        })
        return _obj


