# coding: utf-8

"""
    Elastic Email REST API

    This API is based on the REST API architecture, allowing the user to easily manage their data with this resource-based approach.    Every API call is established on which specific request type (GET, POST, PUT, DELETE) will be used.    The API has a limit of 20 concurrent connections and a hard timeout of 600 seconds per request.    To start using this API, you will need your Access Token (available <a target=\"_blank\" href=\"https://app.elasticemail.com/marketing/settings/new/manage-api\">here</a>). Remember to keep it safe. Required access levels are listed in the given request’s description.    Downloadable library clients can be found in our Github repository <a target=\"_blank\" href=\"https://github.com/ElasticEmail?tab=repositories&q=%22rest+api%22+in%3Areadme\">here</a>

    The version of the OpenAPI document: 4.0.0
    Contact: support@elasticemail.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, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from typing import Optional, Set
from typing_extensions import Self

class SubaccountEmailSettings(BaseModel):
    """
    Settings related to sending emails
    """ # noqa: E501
    monthly_refill_credits: Optional[StrictInt] = Field(default=None, description="Amount of credits added to Account automatically", alias="MonthlyRefillCredits")
    requires_email_credits: Optional[StrictBool] = Field(default=None, description="True, if Account needs credits to send emails. Otherwise, false", alias="RequiresEmailCredits")
    email_size_limit: Optional[StrictInt] = Field(default=None, description="Maximum size of email including attachments in MB's", alias="EmailSizeLimit")
    daily_send_limit: Optional[StrictInt] = Field(default=None, description="Amount of emails Account can send daily", alias="DailySendLimit")
    max_contacts: Optional[StrictInt] = Field(default=None, description="Maximum number of contacts the Account can have. 0 means that parent account's limit is used.", alias="MaxContacts")
    enable_private_ip_purchase: Optional[StrictBool] = Field(default=None, description="Can the SubAccount purchase Private IP for themselves", alias="EnablePrivateIPPurchase")
    pool_name: Optional[StrictStr] = Field(default=None, description="Name of your custom IP Pool to be used in the sending process", alias="PoolName")
    valid_sender_domain_only: Optional[StrictBool] = Field(default=None, alias="ValidSenderDomainOnly")
    __properties: ClassVar[List[str]] = ["MonthlyRefillCredits", "RequiresEmailCredits", "EmailSizeLimit", "DailySendLimit", "MaxContacts", "EnablePrivateIPPurchase", "PoolName", "ValidSenderDomainOnly"]

    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 SubaccountEmailSettings 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,
        )
        # set to None if valid_sender_domain_only (nullable) is None
        # and model_fields_set contains the field
        if self.valid_sender_domain_only is None and "valid_sender_domain_only" in self.model_fields_set:
            _dict['ValidSenderDomainOnly'] = None

        return _dict

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

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

        _obj = cls.model_validate({
            "MonthlyRefillCredits": obj.get("MonthlyRefillCredits"),
            "RequiresEmailCredits": obj.get("RequiresEmailCredits"),
            "EmailSizeLimit": obj.get("EmailSizeLimit"),
            "DailySendLimit": obj.get("DailySendLimit"),
            "MaxContacts": obj.get("MaxContacts"),
            "EnablePrivateIPPurchase": obj.get("EnablePrivateIPPurchase"),
            "PoolName": obj.get("PoolName"),
            "ValidSenderDomainOnly": obj.get("ValidSenderDomainOnly")
        })
        return _obj


