# coding: utf-8

"""
    One-API

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

    The version of the OpenAPI document: 2.0
    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, StrictStr, field_validator
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class CreateJobParams(BaseModel):
    """
    CreateJobParams
    """ # noqa: E501
    type: StrictStr = Field(description="Job creation type")
    time_in_from: datetime = Field(description="Datetime when messages were received on the platform")
    time_in_to: datetime = Field(description="Datetime when messages were received on the platform")
    time_sent_from: Optional[datetime] = Field(default=None, description="Time of sending messages from the platform “from”")
    time_sent_to: Optional[datetime] = Field(default=None, description="Time of sending messages from the platform “to”")
    phones: Optional[List[StrictInt]] = Field(default=None, description="phone list")
    sender: Optional[StrictStr] = Field(default=None, description="Source from where the message came to the platform")
    source: Optional[StrictStr] = Field(default=None, description="Source from where the message came to the platform")
    country: Optional[StrictStr] = Field(default=None, description="The name of the country for search")
    operator_id: Optional[StrictStr] = Field(default=None, description="Indication of the country operator")
    status: Optional[StrictStr] = Field(default=None, description="The status of the messages to display")
    sl_clicks: Optional[StrictStr] = Field(default=None, description="The field is available only to the clients who have enabled Short URL service")
    sl_clicks_comp: Optional[StrictStr] = Field(default=None, description="Comparison operator with the clicks count value")
    sl_clicks_count: Optional[StrictStr] = Field(default=None, description="Comparison operator with the clicks count value")
    __properties: ClassVar[List[str]] = ["type", "time_in_from", "time_in_to", "time_sent_from", "time_sent_to", "phones", "sender", "source", "country", "operator_id", "status", "sl_clicks", "sl_clicks_comp", "sl_clicks_count"]

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

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

        if value not in set(['api', 'web', 'smpp', 'xml', 'http', 'json']):
            raise ValueError("must be one of enum values ('api', 'web', 'smpp', 'xml', 'http', 'json')")
        return value

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

        if value not in set(['api', 'web', 'smpp', 'xml', 'http', 'json']):
            raise ValueError("must be one of enum values ('api', 'web', 'smpp', 'xml', 'http', 'json')")
        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(['Delivered', 'Rejected', 'Scheduled', 'Moderation', 'Accepted', 'Sending', 'Sent', 'Expired', 'Failed', 'Undelivered', 'Unknown']):
            raise ValueError("must be one of enum values ('Delivered', 'Rejected', 'Scheduled', 'Moderation', 'Accepted', 'Sending', 'Sent', 'Expired', 'Failed', 'Undelivered', 'Unknown')")
        return value

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

        if value not in set(['=', '>', '<']):
            raise ValueError("must be one of enum values ('=', '>', '<')")
        return value

    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 CreateJobParams 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,
        )
        return _dict

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

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

        _obj = cls.model_validate({
            "type": obj.get("type"),
            "time_in_from": obj.get("time_in_from"),
            "time_in_to": obj.get("time_in_to"),
            "time_sent_from": obj.get("time_sent_from"),
            "time_sent_to": obj.get("time_sent_to"),
            "phones": obj.get("phones"),
            "sender": obj.get("sender"),
            "source": obj.get("source"),
            "country": obj.get("country"),
            "operator_id": obj.get("operator_id"),
            "status": obj.get("status"),
            "sl_clicks": obj.get("sl_clicks"),
            "sl_clicks_comp": obj.get("sl_clicks_comp"),
            "sl_clicks_count": obj.get("sl_clicks_count")
        })
        return _obj


