<?php
/**
 * Association
 *
 * PHP version 5
 *
 * @category Class
 * @package  XeroAPI\XeroPHP
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Xero Files API
 *
 * These endpoints are specific to Xero Files API
 *
 * Contact: api@xero.com
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 5.4.0
 */

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

namespace XeroAPI\XeroPHP\Models\File;

use \ArrayAccess;
use \XeroAPI\XeroPHP\FileObjectSerializer;
use \XeroAPI\XeroPHP\StringUtil;
use ReturnTypeWillChange;

/**
 * Association Class Doc Comment
 *
 * @category Class
 * @package  XeroAPI\XeroPHP
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */
class Association implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'send_with_object' => 'bool',
        'name' => 'string',
        'size' => 'int',
        'file_id' => 'string',
        'object_id' => 'string',
        'object_group' => '\XeroAPI\XeroPHP\Models\File\ObjectGroup',
        'object_type' => '\XeroAPI\XeroPHP\Models\File\ObjectType'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPIFormats = [
        'send_with_object' => null,
        'name' => null,
        'size' => null,
        'file_id' => 'uuid',
        'object_id' => 'uuid',
        'object_group' => null,
        'object_type' => 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 = [
        'send_with_object' => 'SendWithObject',
        'name' => 'Name',
        'size' => 'Size',
        'file_id' => 'FileId',
        'object_id' => 'ObjectId',
        'object_group' => 'ObjectGroup',
        'object_type' => 'ObjectType'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'send_with_object' => 'setSendWithObject',
        'name' => 'setName',
        'size' => 'setSize',
        'file_id' => 'setFileId',
        'object_id' => 'setObjectId',
        'object_group' => 'setObjectGroup',
        'object_type' => 'setObjectType'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'send_with_object' => 'getSendWithObject',
        'name' => 'getName',
        'size' => 'getSize',
        'file_id' => 'getFileId',
        'object_id' => 'getObjectId',
        'object_group' => 'getObjectGroup',
        'object_type' => 'getObjectType'
    ];

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

    

    

    /**
     * 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['send_with_object'] = isset($data['send_with_object']) ? $data['send_with_object'] : null;
        $this->container['name'] = isset($data['name']) ? $data['name'] : null;
        $this->container['size'] = isset($data['size']) ? $data['size'] : null;
        $this->container['file_id'] = isset($data['file_id']) ? $data['file_id'] : null;
        $this->container['object_id'] = isset($data['object_id']) ? $data['object_id'] : null;
        $this->container['object_group'] = isset($data['object_group']) ? $data['object_group'] : null;
        $this->container['object_type'] = isset($data['object_type']) ? $data['object_type'] : null;
    }

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

        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 send_with_object
     *
     * @return bool|null
     */
    public function getSendWithObject()
    {
        return $this->container['send_with_object'];
    }

    /**
     * Sets send_with_object
     *
     * @param bool|null $send_with_object Boolean flag to determines whether the file is sent with the document it is attached to on client facing communications. Note- The SendWithObject element is only returned when using /Associations/{ObjectId} endpoint.
     *
     * @return $this
     */
    public function setSendWithObject($send_with_object)
    {

        $this->container['send_with_object'] = $send_with_object;

        return $this;
    }



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

    /**
     * Sets name
     *
     * @param string|null $name The name of the associated file. Note- The Name element is only returned when using /Associations/{ObjectId} endpoint.
     *
     * @return $this
     */
    public function setName($name)
    {

        $this->container['name'] = $name;

        return $this;
    }



    /**
     * Gets size
     *
     * @return int|null
     */
    public function getSize()
    {
        return $this->container['size'];
    }

    /**
     * Sets size
     *
     * @param int|null $size The size of the associated file in bytes. Note- The Size element is only returned when using /Associations/{ObjectId} endpoint.
     *
     * @return $this
     */
    public function setSize($size)
    {

        $this->container['size'] = $size;

        return $this;
    }



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

    /**
     * Sets file_id
     *
     * @param string|null $file_id The unique identifier of the file
     *
     * @return $this
     */
    public function setFileId($file_id)
    {

        $this->container['file_id'] = $file_id;

        return $this;
    }



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

    /**
     * Sets object_id
     *
     * @param string|null $object_id The identifier of the object that the file is being associated with (e.g. InvoiceID, BankTransactionID, ContactID)
     *
     * @return $this
     */
    public function setObjectId($object_id)
    {

        $this->container['object_id'] = $object_id;

        return $this;
    }



    /**
     * Gets object_group
     *
     * @return \XeroAPI\XeroPHP\Models\File\ObjectGroup|null
     */
    public function getObjectGroup()
    {
        return $this->container['object_group'];
    }

    /**
     * Sets object_group
     *
     * @param \XeroAPI\XeroPHP\Models\File\ObjectGroup|null $object_group object_group
     *
     * @return $this
     */
    public function setObjectGroup($object_group)
    {

        $this->container['object_group'] = $object_group;

        return $this;
    }



    /**
     * Gets object_type
     *
     * @return \XeroAPI\XeroPHP\Models\File\ObjectType|null
     */
    public function getObjectType()
    {
        return $this->container['object_type'];
    }

    /**
     * Sets object_type
     *
     * @param \XeroAPI\XeroPHP\Models\File\ObjectType|null $object_type object_type
     *
     * @return $this
     */
    public function setObjectType($object_type)
    {

        $this->container['object_type'] = $object_type;

        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()
    {
        return json_encode(
            FileObjectSerializer::sanitizeForSerialization($this),
            JSON_PRETTY_PRINT
        );
    }
}


