# coding: utf-8

"""
    Gmail API

    The Gmail API lets you view and manage Gmail mailbox data like threads, messages, and labels.

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

class VacationSettings(BaseModel):
    """
    Vacation auto-reply settings for an account. These settings correspond to the \"Vacation responder\" feature in the web interface.
    """ # noqa: E501
    enable_auto_reply: Optional[StrictBool] = Field(default=None, description="Flag that controls whether Gmail automatically replies to messages.", alias="enableAutoReply")
    end_time: Optional[StrictStr] = Field(default=None, description="An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.", alias="endTime")
    response_body_html: Optional[StrictStr] = Field(default=None, description="Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.", alias="responseBodyHtml")
    response_body_plain_text: Optional[StrictStr] = Field(default=None, description="Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used.", alias="responseBodyPlainText")
    response_subject: Optional[StrictStr] = Field(default=None, description="Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty.", alias="responseSubject")
    restrict_to_contacts: Optional[StrictBool] = Field(default=None, description="Flag that determines whether responses are sent to recipients who are not in the user's list of contacts.", alias="restrictToContacts")
    restrict_to_domain: Optional[StrictBool] = Field(default=None, description="Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for G Suite users.", alias="restrictToDomain")
    start_time: Optional[StrictStr] = Field(default=None, description="An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`.", alias="startTime")
    __properties: ClassVar[List[str]] = ["enableAutoReply", "endTime", "responseBodyHtml", "responseBodyPlainText", "responseSubject", "restrictToContacts", "restrictToDomain", "startTime"]

    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 VacationSettings 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 VacationSettings from a dict"""
        if obj is None:
            return None

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

        _obj = cls.model_validate({
            "enableAutoReply": obj.get("enableAutoReply"),
            "endTime": obj.get("endTime"),
            "responseBodyHtml": obj.get("responseBodyHtml"),
            "responseBodyPlainText": obj.get("responseBodyPlainText"),
            "responseSubject": obj.get("responseSubject"),
            "restrictToContacts": obj.get("restrictToContacts"),
            "restrictToDomain": obj.get("restrictToDomain"),
            "startTime": obj.get("startTime")
        })
        return _obj


