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

/**
 * BitMEX API
 *
 * ## REST API for the BitMEX Trading Platform  _If you are building automated tools, please subscribe to the_ _[BitMEX API RSS Feed](https://blog.bitmex.com/api_announcement/feed/) for changes. The feed will be updated_ _regularly and is the most reliable way to get downtime and update announcements._  [View Changelog](/app/apiChangelog)  -  #### Getting Started  Base URI: [https://www.bitmex.com/api/v1](/api/v1)  ##### Fetching Data  All REST endpoints are documented below. You can try out any query right from this interface.  Most table queries accept `count`, `start`, and `reverse` params. Set `reverse=true` to get rows newest-first.  Additional documentation regarding filters, timestamps, and authentication is available in [the main API documentation](/app/restAPI).  _All_ table data is available via the [Websocket](/app/wsAPI). We highly recommend using the socket if you want to have the quickest possible data without being subject to ratelimits.  ##### Return Types  By default, all data is returned as JSON. Send `?_format=csv` to get CSV data or `?_format=xml` to get XML data.  ##### Trade Data Queries  _This is only a small subset of what is available, to get you started._  Fill in the parameters and click the `Try it out!` button to try any of these queries.  - [Pricing Data](#!/Quote/Quote_get)  - [Trade Data](#!/Trade/Trade_get)  - [OrderBook Data](#!/OrderBook/OrderBook_getL2)  - [Settlement Data](#!/Settlement/Settlement_get)  - [Exchange Statistics](#!/Stats/Stats_history)  Every function of the BitMEX.com platform is exposed here and documented. Many more functions are available.  ##### Swagger Specification  [⇩ Download Swagger JSON](swagger.json)  -  ## All API Endpoints  Click to expand a section.
 *
 * OpenAPI spec version: 1.2.0
 * Contact: support@bitmex.com
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 * Swagger Codegen version: 2.4.42-SNAPSHOT
 */

/**
 * 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 Swagger\Client\Model;

use \ArrayAccess;
use \Swagger\Client\ObjectSerializer;

/**
 * CollateralSupportAgreement Class Doc Comment
 *
 * @category Class
 * @package  Swagger\Client
 * @author   Swagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */
class CollateralSupportAgreement implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerTypes = [
        'csa_id' => 'string',
        'account' => 'int',
        'currency' => 'string',
        'amount' => 'int',
        'min_amount' => 'int',
        'threshold' => 'int',
        'mm_ratio_margin_call' => 'int',
        'mm_ratio_liquidation' => 'int',
        'start_time' => 'string',
        'maturity_time' => 'string',
        'maturity_instruction' => 'string',
        'csa_status' => 'string',
        'requester' => 'string',
        'client_details' => 'string',
        'text' => 'string',
        'timestamp' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $swaggerFormats = [
        'csa_id' => null,
        'account' => 'int64',
        'currency' => null,
        'amount' => 'int64',
        'min_amount' => 'int64',
        'threshold' => 'int64',
        'mm_ratio_margin_call' => 'int64',
        'mm_ratio_liquidation' => 'int64',
        'start_time' => null,
        'maturity_time' => null,
        'maturity_instruction' => null,
        'csa_status' => null,
        'requester' => null,
        'client_details' => null,
        'text' => null,
        'timestamp' => 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 = [
        'csa_id' => 'csaID',
        'account' => 'account',
        'currency' => 'currency',
        'amount' => 'amount',
        'min_amount' => 'minAmount',
        'threshold' => 'threshold',
        'mm_ratio_margin_call' => 'mmRatioMarginCall',
        'mm_ratio_liquidation' => 'mmRatioLiquidation',
        'start_time' => 'startTime',
        'maturity_time' => 'maturityTime',
        'maturity_instruction' => 'maturityInstruction',
        'csa_status' => 'csaStatus',
        'requester' => 'requester',
        'client_details' => 'clientDetails',
        'text' => 'text',
        'timestamp' => 'timestamp'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'csa_id' => 'setCsaId',
        'account' => 'setAccount',
        'currency' => 'setCurrency',
        'amount' => 'setAmount',
        'min_amount' => 'setMinAmount',
        'threshold' => 'setThreshold',
        'mm_ratio_margin_call' => 'setMmRatioMarginCall',
        'mm_ratio_liquidation' => 'setMmRatioLiquidation',
        'start_time' => 'setStartTime',
        'maturity_time' => 'setMaturityTime',
        'maturity_instruction' => 'setMaturityInstruction',
        'csa_status' => 'setCsaStatus',
        'requester' => 'setRequester',
        'client_details' => 'setClientDetails',
        'text' => 'setText',
        'timestamp' => 'setTimestamp'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'csa_id' => 'getCsaId',
        'account' => 'getAccount',
        'currency' => 'getCurrency',
        'amount' => 'getAmount',
        'min_amount' => 'getMinAmount',
        'threshold' => 'getThreshold',
        'mm_ratio_margin_call' => 'getMmRatioMarginCall',
        'mm_ratio_liquidation' => 'getMmRatioLiquidation',
        'start_time' => 'getStartTime',
        'maturity_time' => 'getMaturityTime',
        'maturity_instruction' => 'getMaturityInstruction',
        'csa_status' => 'getCsaStatus',
        'requester' => 'getRequester',
        'client_details' => 'getClientDetails',
        'text' => 'getText',
        'timestamp' => 'getTimestamp'
    ];

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

    

    

    /**
     * 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['csa_id'] = isset($data['csa_id']) ? $data['csa_id'] : null;
        $this->container['account'] = isset($data['account']) ? $data['account'] : null;
        $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null;
        $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null;
        $this->container['min_amount'] = isset($data['min_amount']) ? $data['min_amount'] : null;
        $this->container['threshold'] = isset($data['threshold']) ? $data['threshold'] : null;
        $this->container['mm_ratio_margin_call'] = isset($data['mm_ratio_margin_call']) ? $data['mm_ratio_margin_call'] : null;
        $this->container['mm_ratio_liquidation'] = isset($data['mm_ratio_liquidation']) ? $data['mm_ratio_liquidation'] : null;
        $this->container['start_time'] = isset($data['start_time']) ? $data['start_time'] : null;
        $this->container['maturity_time'] = isset($data['maturity_time']) ? $data['maturity_time'] : null;
        $this->container['maturity_instruction'] = isset($data['maturity_instruction']) ? $data['maturity_instruction'] : null;
        $this->container['csa_status'] = isset($data['csa_status']) ? $data['csa_status'] : null;
        $this->container['requester'] = isset($data['requester']) ? $data['requester'] : null;
        $this->container['client_details'] = isset($data['client_details']) ? $data['client_details'] : null;
        $this->container['text'] = isset($data['text']) ? $data['text'] : null;
        $this->container['timestamp'] = isset($data['timestamp']) ? $data['timestamp'] : null;
    }

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

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

    /**
     * Sets csa_id
     *
     * @param string $csa_id csa_id
     *
     * @return $this
     */
    public function setCsaId($csa_id)
    {
        $this->container['csa_id'] = $csa_id;

        return $this;
    }

    /**
     * Gets account
     *
     * @return int
     */
    public function getAccount()
    {
        return $this->container['account'];
    }

    /**
     * Sets account
     *
     * @param int $account account
     *
     * @return $this
     */
    public function setAccount($account)
    {
        $this->container['account'] = $account;

        return $this;
    }

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

    /**
     * Sets currency
     *
     * @param string $currency currency
     *
     * @return $this
     */
    public function setCurrency($currency)
    {
        $this->container['currency'] = $currency;

        return $this;
    }

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

    /**
     * Sets amount
     *
     * @param int $amount amount
     *
     * @return $this
     */
    public function setAmount($amount)
    {
        $this->container['amount'] = $amount;

        return $this;
    }

    /**
     * Gets min_amount
     *
     * @return int
     */
    public function getMinAmount()
    {
        return $this->container['min_amount'];
    }

    /**
     * Sets min_amount
     *
     * @param int $min_amount min_amount
     *
     * @return $this
     */
    public function setMinAmount($min_amount)
    {
        $this->container['min_amount'] = $min_amount;

        return $this;
    }

    /**
     * Gets threshold
     *
     * @return int
     */
    public function getThreshold()
    {
        return $this->container['threshold'];
    }

    /**
     * Sets threshold
     *
     * @param int $threshold threshold
     *
     * @return $this
     */
    public function setThreshold($threshold)
    {
        $this->container['threshold'] = $threshold;

        return $this;
    }

    /**
     * Gets mm_ratio_margin_call
     *
     * @return int
     */
    public function getMmRatioMarginCall()
    {
        return $this->container['mm_ratio_margin_call'];
    }

    /**
     * Sets mm_ratio_margin_call
     *
     * @param int $mm_ratio_margin_call mm_ratio_margin_call
     *
     * @return $this
     */
    public function setMmRatioMarginCall($mm_ratio_margin_call)
    {
        $this->container['mm_ratio_margin_call'] = $mm_ratio_margin_call;

        return $this;
    }

    /**
     * Gets mm_ratio_liquidation
     *
     * @return int
     */
    public function getMmRatioLiquidation()
    {
        return $this->container['mm_ratio_liquidation'];
    }

    /**
     * Sets mm_ratio_liquidation
     *
     * @param int $mm_ratio_liquidation mm_ratio_liquidation
     *
     * @return $this
     */
    public function setMmRatioLiquidation($mm_ratio_liquidation)
    {
        $this->container['mm_ratio_liquidation'] = $mm_ratio_liquidation;

        return $this;
    }

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

    /**
     * Sets start_time
     *
     * @param string $start_time start_time
     *
     * @return $this
     */
    public function setStartTime($start_time)
    {
        $this->container['start_time'] = $start_time;

        return $this;
    }

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

    /**
     * Sets maturity_time
     *
     * @param string $maturity_time maturity_time
     *
     * @return $this
     */
    public function setMaturityTime($maturity_time)
    {
        $this->container['maturity_time'] = $maturity_time;

        return $this;
    }

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

    /**
     * Sets maturity_instruction
     *
     * @param string $maturity_instruction maturity_instruction
     *
     * @return $this
     */
    public function setMaturityInstruction($maturity_instruction)
    {
        $this->container['maturity_instruction'] = $maturity_instruction;

        return $this;
    }

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

    /**
     * Sets csa_status
     *
     * @param string $csa_status csa_status
     *
     * @return $this
     */
    public function setCsaStatus($csa_status)
    {
        $this->container['csa_status'] = $csa_status;

        return $this;
    }

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

    /**
     * Sets requester
     *
     * @param string $requester requester
     *
     * @return $this
     */
    public function setRequester($requester)
    {
        $this->container['requester'] = $requester;

        return $this;
    }

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

    /**
     * Sets client_details
     *
     * @param string $client_details client_details
     *
     * @return $this
     */
    public function setClientDetails($client_details)
    {
        $this->container['client_details'] = $client_details;

        return $this;
    }

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

    /**
     * Sets text
     *
     * @param string $text text
     *
     * @return $this
     */
    public function setText($text)
    {
        $this->container['text'] = $text;

        return $this;
    }

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

    /**
     * Sets timestamp
     *
     * @param string $timestamp timestamp
     *
     * @return $this
     */
    public function setTimestamp($timestamp)
    {
        $this->container['timestamp'] = $timestamp;

        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(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

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


