<?php
/**
 * BillOverviewDetailDto
 *
 * PHP version 5
 *
 * @category Class
 * @package  Yeepay\Yop\Sdk\
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * 会员钱包
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: 1.0
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 3.0.13
 */

/**
 * 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 Yeepay\Yop\Sdk\Service\MWallet\Model;

use \ArrayAccess;
use Yeepay\Yop\Sdk\Model\ModelInterface;
use Yeepay\Yop\Sdk\Utils\ObjectSerializer;

/**
 * BillOverviewDetailDto Class Doc Comment
 *
 * @category Class
 * @description 账单总览月份详情
 * @package  Yeepay\Yop\Sdk\
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class BillOverviewDetailDto implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

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

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'trxCode' => 'enum',
        'amount' => 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 = [
        'trxCode' => 'trxCode',
        'amount' => 'amount'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'trxCode' => 'setTrxCode',
        'amount' => 'setAmount'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'trxCode' => 'getTrxCode',
        'amount' => 'getAmount'
    ];

    /**
     * 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 TRX_CODE_RECHARGE = 'RECHARGE';
    const TRX_CODE_WITHDRAW = 'WITHDRAW';
    const TRX_CODE_BALANCE_PAY = 'BALANCE_PAY';
    const TRX_CODE_CARD_PAY = 'CARD_PAY';
    const TRX_CODE_BANK_TRANSFER = 'BANK_TRANSFER';
    const TRX_CODE_PAY_REFUND = 'PAY_REFUND';
    const TRX_CODE_DIVIDE = 'DIVIDE';
    const TRX_CODE_DIVIED_REFUND = 'DIVIED_REFUND';
    

    
    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTrxCodeAllowableValues()
    {
        return [
            self::TRX_CODE_RECHARGE,
            self::TRX_CODE_WITHDRAW,
            self::TRX_CODE_BALANCE_PAY,
            self::TRX_CODE_CARD_PAY,
            self::TRX_CODE_BANK_TRANSFER,
            self::TRX_CODE_PAY_REFUND,
            self::TRX_CODE_DIVIDE,
            self::TRX_CODE_DIVIED_REFUND,
        ];
    }
    

    /**
     * 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['trxCode'] = isset($data['trxCode']) ? $data['trxCode'] : null;
        $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null;
    }

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

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

        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 trxCode
     *
     * @return string
     */
    public function getTrxCode()
    {
        return $this->container['trxCode'];
    }

    /**
     * Sets trxCode
     *
     * @param string $trxCode <div data-page-id=\"PAIVdmdabo9DDcxbHUWcsiHvn7b\" data-docx-has-block-data=\"false\"> <div class=\"ace-line ace-line old-record-id-Be4kdGCa2omy8KxZSedcFzp3nwA\"><em>交易类型</em></div> </div> 可选项如下: RECHARGE:充值 WITHDRAW:提现 BALANCE_PAY:余额支付 CARD_PAY:绑卡支付 BANK_TRANSFER:银行卡转账 PAY_REFUND:退款 DIVIDE:分账 DIVIED_REFUND:分账退回
     *
     * @return $this
     */
    public function setTrxCode($trxCode)
    {
        $allowedValues = $this->getTrxCodeAllowableValues();
        if (!in_array($trxCode, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value for 'trxCode', must be one of '%s'",
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['trxCode'] = $trxCode;

        return $this;
    }

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

    /**
     * Sets amount
     *
     * @param string $amount <p>汇总金额</p> <div data-page-id=\"PAIVdmdabo9DDcxbHUWcsiHvn7b\" data-docx-has-block-data=\"false\"> <div class=\" old-record-id-JIswdsMwkogUygxiOShc30LwnSh\">精确至两位小数</div> </div>
     *
     * @return $this
     */
    public function setAmount($amount)
    {
        $this->container['amount'] = $amount;

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

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    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
     */
    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
     */
    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(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}


