<?php

/**
 * GetAccountPlan
 *
 * PHP version 5
 *
 * @category Class
 * @package  SendinBlue\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
/**
 * SendinBlue API
 *
 * SendinBlue provide a RESTFul API that can be used with any languages. With this API, you will be able to :   - Manage your campaigns and get the statistics   - Manage your contacts   - Send transactional Emails and SMS   - and much more...  You can download our wrappers at https://github.com/orgs/sendinblue  **Possible responses**   | Code | Message |   | :-------------: | ------------- |   | 200  | OK. Successful Request  |   | 201  | OK. Successful Creation |   | 202  | OK. Request accepted |   | 204  | OK. Successful Update/Deletion  |   | 400  | Error. Bad Request  |   | 401  | Error. Authentication Needed  |   | 402  | Error. Not enough credit, plan upgrade needed  |   | 403  | Error. Permission denied  |   | 404  | Error. Object does not exist |   | 405  | Error. Method not allowed  |   | 406  | Error. Not Acceptable  |
 *
 * OpenAPI spec version: 3.0.0
 * Contact: contact@sendinblue.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.29
 */
/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */
namespace WPMailSMTP\Vendor\SendinBlue\Client\Model;

use ArrayAccess;
use WPMailSMTP\Vendor\SendinBlue\Client\ObjectSerializer;
/**
 * GetAccountPlan Class Doc Comment
 *
 * @category Class
 * @package  SendinBlue\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class GetAccountPlan implements \WPMailSMTP\Vendor\SendinBlue\Client\Model\ModelInterface, \ArrayAccess
{
    const DISCRIMINATOR = null;
    /**
     * The original name of the model.
     *
     * @var string
     */
    protected static $swaggerModelName = 'getAccount_plan';
    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @var string[]
     */
    protected static $swaggerTypes = ['type' => 'string', 'creditsType' => 'string', 'credits' => 'float', 'startDate' => '\\DateTime', 'endDate' => '\\DateTime', 'userLimit' => 'int'];
    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @var string[]
     */
    protected static $swaggerFormats = ['type' => null, 'creditsType' => null, 'credits' => 'float', 'startDate' => 'date', 'endDate' => 'date', 'userLimit' => null];
    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }
    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function swaggerFormats()
    {
        return self::$swaggerFormats;
    }
    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = ['type' => 'type', 'creditsType' => 'creditsType', 'credits' => 'credits', 'startDate' => 'startDate', 'endDate' => 'endDate', 'userLimit' => 'userLimit'];
    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = ['type' => 'setType', 'creditsType' => 'setCreditsType', 'credits' => 'setCredits', 'startDate' => 'setStartDate', 'endDate' => 'setEndDate', 'userLimit' => 'setUserLimit'];
    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = ['type' => 'getType', 'creditsType' => 'getCreditsType', 'credits' => 'getCredits', 'startDate' => 'getStartDate', 'endDate' => 'getEndDate', 'userLimit' => 'getUserLimit'];
    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }
    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }
    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }
    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$swaggerModelName;
    }
    const TYPE_PAY_AS_YOU_GO = 'payAsYouGo';
    const TYPE_FREE = 'free';
    const TYPE_SUBSCRIPTION = 'subscription';
    const TYPE_SMS = 'sms';
    const TYPE_RESELLER = 'reseller';
    const CREDITS_TYPE_SEND_LIMIT = 'sendLimit';
    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTypeAllowableValues()
    {
        return [self::TYPE_PAY_AS_YOU_GO, self::TYPE_FREE, self::TYPE_SUBSCRIPTION, self::TYPE_SMS, self::TYPE_RESELLER];
    }
    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getCreditsTypeAllowableValues()
    {
        return [self::CREDITS_TYPE_SEND_LIMIT];
    }
    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];
    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['type'] = isset($data['type']) ? $data['type'] : null;
        $this->container['creditsType'] = isset($data['creditsType']) ? $data['creditsType'] : null;
        $this->container['credits'] = isset($data['credits']) ? $data['credits'] : null;
        $this->container['startDate'] = isset($data['startDate']) ? $data['startDate'] : null;
        $this->container['endDate'] = isset($data['endDate']) ? $data['endDate'] : null;
        $this->container['userLimit'] = isset($data['userLimit']) ? $data['userLimit'] : null;
    }
    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];
        if ($this->container['type'] === null) {
            $invalidProperties[] = "'type' can't be null";
        }
        $allowedValues = $this->getTypeAllowableValues();
        if (!\is_null($this->container['type']) && !\in_array($this->container['type'], $allowedValues, \true)) {
            $invalidProperties[] = \sprintf("invalid value for 'type', must be one of '%s'", \implode("', '", $allowedValues));
        }
        if ($this->container['creditsType'] === null) {
            $invalidProperties[] = "'creditsType' can't be null";
        }
        $allowedValues = $this->getCreditsTypeAllowableValues();
        if (!\is_null($this->container['creditsType']) && !\in_array($this->container['creditsType'], $allowedValues, \true)) {
            $invalidProperties[] = \sprintf("invalid value for 'creditsType', must be one of '%s'", \implode("', '", $allowedValues));
        }
        if ($this->container['credits'] === null) {
            $invalidProperties[] = "'credits' can't be null";
        }
        return $invalidProperties;
    }
    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return \count($this->listInvalidProperties()) === 0;
    }
    /**
     * Gets type
     *
     * @return string
     */
    public function getType()
    {
        return $this->container['type'];
    }
    /**
     * Sets type
     *
     * @param string $type Displays the plan type of the user
     *
     * @return $this
     */
    public function setType($type)
    {
        $allowedValues = $this->getTypeAllowableValues();
        if (!\in_array($type, $allowedValues, \true)) {
            throw new \InvalidArgumentException(\sprintf("Invalid value for 'type', must be one of '%s'", \implode("', '", $allowedValues)));
        }
        $this->container['type'] = $type;
        return $this;
    }
    /**
     * Gets creditsType
     *
     * @return string
     */
    public function getCreditsType()
    {
        return $this->container['creditsType'];
    }
    /**
     * Sets creditsType
     *
     * @param string $creditsType This is the type of the credit, \"Send Limit\" is one of the possible types of credit of a user. \"Send Limit\" implies the total number of emails you can send to the subscribers in your account.
     *
     * @return $this
     */
    public function setCreditsType($creditsType)
    {
        $allowedValues = $this->getCreditsTypeAllowableValues();
        if (!\in_array($creditsType, $allowedValues, \true)) {
            throw new \InvalidArgumentException(\sprintf("Invalid value for 'creditsType', must be one of '%s'", \implode("', '", $allowedValues)));
        }
        $this->container['creditsType'] = $creditsType;
        return $this;
    }
    /**
     * Gets credits
     *
     * @return float
     */
    public function getCredits()
    {
        return $this->container['credits'];
    }
    /**
     * Sets credits
     *
     * @param float $credits Remaining credits of the user
     *
     * @return $this
     */
    public function setCredits($credits)
    {
        $this->container['credits'] = $credits;
        return $this;
    }
    /**
     * Gets startDate
     *
     * @return \DateTime
     */
    public function getStartDate()
    {
        return $this->container['startDate'];
    }
    /**
     * Sets startDate
     *
     * @param \DateTime $startDate Date of the period from which the plan will start (only available for \"subscription\" and \"reseller\" plan type)
     *
     * @return $this
     */
    public function setStartDate($startDate)
    {
        $this->container['startDate'] = $startDate;
        return $this;
    }
    /**
     * Gets endDate
     *
     * @return \DateTime
     */
    public function getEndDate()
    {
        return $this->container['endDate'];
    }
    /**
     * Sets endDate
     *
     * @param \DateTime $endDate Date of the period from which the plan will end (only available for \"subscription\" and \"reseller\" plan type)
     *
     * @return $this
     */
    public function setEndDate($endDate)
    {
        $this->container['endDate'] = $endDate;
        return $this;
    }
    /**
     * Gets userLimit
     *
     * @return int
     */
    public function getUserLimit()
    {
        return $this->container['userLimit'];
    }
    /**
     * Sets userLimit
     *
     * @param int $userLimit Only in case of reseller account. It implies the total number of child accounts you can add to your account.
     *
     * @return $this
     */
    public function setUserLimit($userLimit)
    {
        $this->container['userLimit'] = $userLimit;
        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }
    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }
    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (\is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }
    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }
    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (\defined('JSON_PRETTY_PRINT')) {
            // use JSON pretty print
            return \json_encode(\WPMailSMTP\Vendor\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this), \JSON_PRETTY_PRINT);
        }
        return \json_encode(\WPMailSMTP\Vendor\SendinBlue\Client\ObjectSerializer::sanitizeForSerialization($this));
    }
}
