<?php
/**
 * AlipayOpenAgentMiniCreateErrorResponseModel
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  Alipay\OpenAPISDK
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * 支付宝开放平台API
 *
 * 支付宝开放平台v3协议文档
 *
 * The version of the OpenAPI document: 2023-12-20
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.2.1
 */

/**
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

namespace Alipay\OpenAPISDK\Model;

use \ArrayAccess;
use \Alipay\OpenAPISDK\ObjectSerializer;

/**
 * AlipayOpenAgentMiniCreateErrorResponseModel Class Doc Comment
 *
 * @category Class
 * @package  Alipay\OpenAPISDK
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class AlipayOpenAgentMiniCreateErrorResponseModel implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $openAPIModelName = 'AlipayOpenAgentMiniCreateErrorResponseModel';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'code' => 'string',
        'links' => 'string',
        'message' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'code' => null,
        'links' => null,
        'message' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPITypes()
    {
        return self::$openAPITypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function openAPIFormats()
    {
        return self::$openAPIFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'code' => 'code',
        'links' => 'links',
        'message' => 'message'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'code' => 'setCode',
        'links' => 'setLinks',
        'message' => 'setMessage'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'code' => 'getCode',
        'links' => 'getLinks',
        'message' => 'getMessage'
    ];

    /**
     * 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::$openAPIModelName;
    }

    public const CODE_INVALID_PARAMETER = 'INVALID_PARAMETER';
    public const CODE_INVALID_BATCH_NO = 'INVALID_BATCH_NO';
    public const CODE_NO_APP_PERMISSION = 'NO_APP_PERMISSION';
    public const CODE_BATCH_STATUS_IS_FINAL = 'BATCH_STATUS_IS_FINAL';
    public const CODE_APP_INFO_NOT_EXIST = 'APP_INFO_NOT_EXIST';
    public const CODE_ISV_APP_NO_TINYAPP_SCENE = 'ISV_APP_NO_TINYAPP_SCENE';
    public const CODE_BATCH_IS_NOT_EXIST = 'BATCH_IS_NOT_EXIST';
    public const CODE_MERCHANT_NOT_ENTERPRISE = 'MERCHANT_NOT_ENTERPRISE';
    public const CODE_APP_NAME_IS_BLANK = 'APP_NAME_IS_BLANK';
    public const CODE_INVALID_MINI_APP_NAME = 'INVALID_MINI_APP_NAME';
    public const CODE_INVALID_MINI_APP_NAME_LENGTH = 'INVALID_MINI_APP_NAME_LENGTH';
    public const CODE_MINI_APP_NAME_DUPLICATE = 'MINI_APP_NAME_DUPLICATE';
    public const CODE_MINI_APP_NAME_SENSITIVE = 'MINI_APP_NAME_SENSITIVE';
    public const CODE_ENGLISH_NAME_IS_BLANK = 'ENGLISH_NAME_IS_BLANK';
    public const CODE_INVALID_MINI_APP_EN_NAME = 'INVALID_MINI_APP_EN_NAME';
    public const CODE_INVALID_MINI_APP_EN_NAME_LENGTH = 'INVALID_MINI_APP_EN_NAME_LENGTH';
    public const CODE_MINI_APP_EN_NAME_DUPLICATE = 'MINI_APP_EN_NAME_DUPLICATE';
    public const CODE_MINI_APP_EN_NAME_SENSITIVE = 'MINI_APP_EN_NAME_SENSITIVE';
    public const CODE_LOGO_IS_BLANK = 'LOGO_IS_BLANK';
    public const CODE_SLOGAN_IS_BLANK = 'SLOGAN_IS_BLANK';
    public const CODE_INVALID_MINI_APP_SLOGAN_LENGTH = 'INVALID_MINI_APP_SLOGAN_LENGTH';
    public const CODE_INVALID_MINI_APP_SLOGAN = 'INVALID_MINI_APP_SLOGAN';
    public const CODE_MINI_APP_SLOGAN_SENSITIVE = 'MINI_APP_SLOGAN_SENSITIVE';
    public const CODE_SERVICE_TEL_AND_MAIL_BOTH_BLANK = 'SERVICE_TEL_AND_MAIL_BOTH_BLANK';
    public const CODE_INVALID_MINI_APP_SERVICE_TEL = 'INVALID_MINI_APP_SERVICE_TEL';
    public const CODE_INVALID_MINI_APP_SERVICE_MAIL = 'INVALID_MINI_APP_SERVICE_MAIL';
    public const CODE_MINI_APP_SERVICE_MAIL_SENSITIVE = 'MINI_APP_SERVICE_MAIL_SENSITIVE';
    public const CODE_CATEGORY_IS_BLANK = 'CATEGORY_IS_BLANK';
    public const CODE_CATEGOTY_NUM_IS_INVALID = 'CATEGOTY_NUM_IS_INVALID';
    public const CODE_INVALID_CATEGORY = 'INVALID_CATEGORY';
    public const CODE_APP_DESC_IS_BLANK = 'APP_DESC_IS_BLANK';
    public const CODE_INVALID_MINI_APP_DESC_LENGTH = 'INVALID_MINI_APP_DESC_LENGTH';
    public const CODE_INVALID_MINI_APP_DESC = 'INVALID_MINI_APP_DESC';
    public const CODE_PID_IS_BLANK = 'PID_IS_BLANK';
    public const CODE_CREATE_MINI_APP_EXCEED_MAX_COUNT = 'CREATE_MINI_APP_EXCEED_MAX_COUNT';
    public const CODE_CREATE_MINI_APP_PID_PUNISH = 'CREATE_MINI_APP_PID_PUNISH';
    public const CODE_FILE_FORMAT_IS_INVALID = 'FILE_FORMAT_IS_INVALID';
    public const CODE_FILE_SIZE_OUT_LIMIT = 'FILE_SIZE_OUT_LIMIT';
    public const CODE_PRE_AUTH_INVALID_AUTH_TICKET = 'PRE_AUTH_INVALID_AUTH_TICKET';
    public const CODE_PRE_AUTH_INVALID_AUTH_TOKEN = 'PRE_AUTH_INVALID_AUTH_TOKEN';
    public const CODE_PRE_AUTH_INVOKE_API_NOT_PERMITTE = 'PRE_AUTH_INVOKE_API_NOT_PERMITTE';
    public const CODE_PRE_AUTH_INVALID_CREATE_APPLICAT = 'PRE_AUTH_INVALID_CREATE_APPLICAT';
    public const CODE_PRE_AUTH_INVALID_AUTH_APP_ID = 'PRE_AUTH_INVALID_AUTH_APP_ID';
    public const CODE_PRE_AUTH_TICKET_CREATE_APP_ONCE = 'PRE_AUTH_TICKET_CREATE_APP_ONCE';
    public const CODE_BLACK_LIST_CHECK_FAIL = 'BLACK_LIST_CHECK_FAIL';
    public const CODE_RISK_DECISION_CHECK_FAIL = 'RISK_DECISION_CHECK_FAIL';
    public const CODE_RISK_DECISION_HIT_BRAND = 'RISK_DECISION_HIT_BRAND';
    public const CODE_INVALID_CONTACT_MOBILE = 'INVALID_CONTACT_MOBILE';
    public const CODE_INVALID_CONTACT_NAME = 'INVALID_CONTACT_NAME';
    public const CODE_INVALID_CONTACT_EMAIL = 'INVALID_CONTACT_EMAIL';
    public const CODE_MERCHANT_IS_NOT_EXIST = 'MERCHANT_IS_NOT_EXIST';
    public const CODE_MERCHANT_NOT_ACTIVED = 'MERCHANT_NOT_ACTIVED';
    public const CODE_MERCHANT_CAN_NOT_LOGON = 'MERCHANT_CAN_NOT_LOGON';
    public const CODE_MERCHANT_NOT_ENABLED = 'MERCHANT_NOT_ENABLED';
    public const CODE_MERCHANT_NOT_CERTIFIED = 'MERCHANT_NOT_CERTIFIED';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getCodeAllowableValues()
    {
        return [
            self::CODE_INVALID_PARAMETER,
            self::CODE_INVALID_BATCH_NO,
            self::CODE_NO_APP_PERMISSION,
            self::CODE_BATCH_STATUS_IS_FINAL,
            self::CODE_APP_INFO_NOT_EXIST,
            self::CODE_ISV_APP_NO_TINYAPP_SCENE,
            self::CODE_BATCH_IS_NOT_EXIST,
            self::CODE_MERCHANT_NOT_ENTERPRISE,
            self::CODE_APP_NAME_IS_BLANK,
            self::CODE_INVALID_MINI_APP_NAME,
            self::CODE_INVALID_MINI_APP_NAME_LENGTH,
            self::CODE_MINI_APP_NAME_DUPLICATE,
            self::CODE_MINI_APP_NAME_SENSITIVE,
            self::CODE_ENGLISH_NAME_IS_BLANK,
            self::CODE_INVALID_MINI_APP_EN_NAME,
            self::CODE_INVALID_MINI_APP_EN_NAME_LENGTH,
            self::CODE_MINI_APP_EN_NAME_DUPLICATE,
            self::CODE_MINI_APP_EN_NAME_SENSITIVE,
            self::CODE_LOGO_IS_BLANK,
            self::CODE_SLOGAN_IS_BLANK,
            self::CODE_INVALID_MINI_APP_SLOGAN_LENGTH,
            self::CODE_INVALID_MINI_APP_SLOGAN,
            self::CODE_MINI_APP_SLOGAN_SENSITIVE,
            self::CODE_SERVICE_TEL_AND_MAIL_BOTH_BLANK,
            self::CODE_INVALID_MINI_APP_SERVICE_TEL,
            self::CODE_INVALID_MINI_APP_SERVICE_MAIL,
            self::CODE_MINI_APP_SERVICE_MAIL_SENSITIVE,
            self::CODE_CATEGORY_IS_BLANK,
            self::CODE_CATEGOTY_NUM_IS_INVALID,
            self::CODE_INVALID_CATEGORY,
            self::CODE_APP_DESC_IS_BLANK,
            self::CODE_INVALID_MINI_APP_DESC_LENGTH,
            self::CODE_INVALID_MINI_APP_DESC,
            self::CODE_PID_IS_BLANK,
            self::CODE_CREATE_MINI_APP_EXCEED_MAX_COUNT,
            self::CODE_CREATE_MINI_APP_PID_PUNISH,
            self::CODE_FILE_FORMAT_IS_INVALID,
            self::CODE_FILE_SIZE_OUT_LIMIT,
            self::CODE_PRE_AUTH_INVALID_AUTH_TICKET,
            self::CODE_PRE_AUTH_INVALID_AUTH_TOKEN,
            self::CODE_PRE_AUTH_INVOKE_API_NOT_PERMITTE,
            self::CODE_PRE_AUTH_INVALID_CREATE_APPLICAT,
            self::CODE_PRE_AUTH_INVALID_AUTH_APP_ID,
            self::CODE_PRE_AUTH_TICKET_CREATE_APP_ONCE,
            self::CODE_BLACK_LIST_CHECK_FAIL,
            self::CODE_RISK_DECISION_CHECK_FAIL,
            self::CODE_RISK_DECISION_HIT_BRAND,
            self::CODE_INVALID_CONTACT_MOBILE,
            self::CODE_INVALID_CONTACT_NAME,
            self::CODE_INVALID_CONTACT_EMAIL,
            self::CODE_MERCHANT_IS_NOT_EXIST,
            self::CODE_MERCHANT_NOT_ACTIVED,
            self::CODE_MERCHANT_CAN_NOT_LOGON,
            self::CODE_MERCHANT_NOT_ENABLED,
            self::CODE_MERCHANT_NOT_CERTIFIED,
        ];
    }

    /**
     * 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['code'] = $data['code'] ?? null;
        $this->container['links'] = $data['links'] ?? null;
        $this->container['message'] = $data['message'] ?? null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        if ($this->container['code'] === null) {
            $invalidProperties[] = "'code' can't be null";
        }
        $allowedValues = $this->getCodeAllowableValues();
        if (!is_null($this->container['code']) && !in_array($this->container['code'], $allowedValues, true)) {
            $invalidProperties[] = sprintf(
                "invalid value '%s' for 'code', must be one of '%s'",
                $this->container['code'],
                implode("', '", $allowedValues)
            );
        }

        if ($this->container['message'] === null) {
            $invalidProperties[] = "'message' 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 code
     *
     * @return string
     */
    public function getCode()
    {
        return $this->container['code'];
    }

    /**
     * Sets code
     *
     * @param string $code 错误码
     *
     * @return self
     */
    public function setCode($code)
    {
        $allowedValues = $this->getCodeAllowableValues();
        if (!in_array($code, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'code', must be one of '%s'",
                    $code,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['code'] = $code;

        return $this;
    }

    /**
     * Gets links
     *
     * @return string|null
     */
    public function getLinks()
    {
        return $this->container['links'];
    }

    /**
     * Sets links
     *
     * @param string|null $links 解决方案链接
     *
     * @return self
     */
    public function setLinks($links)
    {
        $this->container['links'] = $links;

        return $this;
    }

    /**
     * Gets message
     *
     * @return string
     */
    public function getMessage()
    {
        return $this->container['message'];
    }

    /**
     * Sets message
     *
     * @param string $message 错误描述
     *
     * @return self
     */
    public function setMessage($message)
    {
        $this->container['message'] = $message;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    public function offsetExists($offset): bool
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return $this->container[$offset] ?? null;
    }

    /**
     * Sets value based on offset.
     *
     * @param int|null $offset Offset
     * @param mixed    $value  Value to be set
     *
     * @return void
     */
    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    public function offsetUnset($offset): void
    {
        unset($this->container[$offset]);
    }

    /**
     * Serializes the object to a value that can be serialized natively by json_encode().
     * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php
     *
     * @return mixed Returns data which can be serialized by json_encode(), which is a value
     * of any type other than a resource.
     */
    #[\ReturnTypeWillChange]
    public function jsonSerialize()
    {
       return ObjectSerializer::sanitizeForSerialization($this);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        return json_encode(
            ObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }

    /**
     * Gets a header-safe presentation of the object
     *
     * @return string
     */
    public function toHeaderValue()
    {
        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


