<?php
/**
 * FortnoxAnlAssetsSinglePayloadItem
 *
 * PHP version 8.1
 *
 * @category Class
 * @package  Fortnox
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * Fortnox API
 *
 * # Documentation   The Fortnox API is organized around REST. This means that we’ve designed it to have resource-oriented URLs and be as predictable as possible for you as developer.  It also means that we use HTTP status codes when something goes wrong and HTTP verbs understod by many API clients around the web.  We use a modified version of OAuth2 for authentication to offer a secure way for both you and our users to interact.  The API is generally built to support both XML and JSON but in this documentation all the examples will be in JSON.  We encourage you to read all the articles in the [Guides & Good to Know section](https://www.fortnox.se/developer/guides-and-good-to-know/)</a> first, before going forward and learning about the different resources.  This to ensure you get an understanding of some of the shared components of the API such as parameters and error handling.  ## Rate limits  The limit per access-token is 25 requests per 5 seconds. This equals to 300 requests per minute.  [Read more about this here.](https://www.fortnox.se/developer/guides-and-good-to-know/rate-limits-for-fortnox-api/)  ## Query parameters  Use query parameters with the ?-character and separate parameters with the &-character.   **Example:**  GET - https://api.fortnox.se/3/invoices?accountnumberfrom=3000&accountnumberto=4000 Read more about our parameters [here](https://www.fortnox.se/developer/guides-and-good-to-know/parameters/)   Search the documentation using the search field in the top left corner.
 *
 * The version of the OpenAPI document: 
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.19.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 Fortnox\Model;

use \ArrayAccess;
use \Fortnox\ObjectSerializer;

/**
 * FortnoxAnlAssetsSinglePayloadItem Class Doc Comment
 *
 * @category Class
 * @package  Fortnox
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<string, mixed>
 */
class FortnoxAnlAssetsSinglePayloadItem implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'acquisition_date' => 'string',
        'acquisition_start' => 'string',
        'acquisition_value' => 'string',
        'brand' => 'string',
        'cost_center' => 'string',
        'department' => 'string',
        'depreciate_to_residual_value' => 'float',
        'depreciation_final' => 'string',
        'depreciation_method' => 'string',
        'description' => 'string',
        'group' => 'string',
        'insured_number' => 'string',
        'insured_with' => 'string',
        'notes' => 'string',
        'number' => 'string',
        'placement' => 'string',
        'project' => 'string',
        'reference' => 'string',
        'room' => 'string',
        'type_id' => '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 = [
        'acquisition_date' => null,
        'acquisition_start' => null,
        'acquisition_value' => null,
        'brand' => null,
        'cost_center' => null,
        'department' => null,
        'depreciate_to_residual_value' => 'float',
        'depreciation_final' => null,
        'depreciation_method' => null,
        'description' => null,
        'group' => null,
        'insured_number' => null,
        'insured_with' => null,
        'notes' => null,
        'number' => null,
        'placement' => null,
        'project' => null,
        'reference' => null,
        'room' => null,
        'type_id' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'acquisition_date' => false,
        'acquisition_start' => false,
        'acquisition_value' => false,
        'brand' => false,
        'cost_center' => false,
        'department' => false,
        'depreciate_to_residual_value' => false,
        'depreciation_final' => false,
        'depreciation_method' => false,
        'description' => false,
        'group' => false,
        'insured_number' => false,
        'insured_with' => false,
        'notes' => false,
        'number' => false,
        'placement' => false,
        'project' => false,
        'reference' => false,
        'room' => false,
        'type_id' => false
    ];

    /**
      * If a nullable field gets set to null, insert it here
      *
      * @var boolean[]
      */
    protected array $openAPINullablesSetToNull = [];

    /**
     * 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 nullable properties
     *
     * @return array
     */
    protected static function openAPINullables(): array
    {
        return self::$openAPINullables;
    }

    /**
     * Array of nullable field names deliberately set to null
     *
     * @return boolean[]
     */
    private function getOpenAPINullablesSetToNull(): array
    {
        return $this->openAPINullablesSetToNull;
    }

    /**
     * Setter - Array of nullable field names deliberately set to null
     *
     * @param boolean[] $openAPINullablesSetToNull
     */
    private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void
    {
        $this->openAPINullablesSetToNull = $openAPINullablesSetToNull;
    }

    /**
     * Checks if a property is nullable
     *
     * @param string $property
     * @return bool
     */
    public static function isNullable(string $property): bool
    {
        return self::openAPINullables()[$property] ?? false;
    }

    /**
     * Checks if a nullable property is set to null.
     *
     * @param string $property
     * @return bool
     */
    public function isNullableSetToNull(string $property): bool
    {
        return in_array($property, $this->getOpenAPINullablesSetToNull(), true);
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'acquisition_date' => 'AcquisitionDate',
        'acquisition_start' => 'AcquisitionStart',
        'acquisition_value' => 'AcquisitionValue',
        'brand' => 'Brand',
        'cost_center' => 'CostCenter',
        'department' => 'Department',
        'depreciate_to_residual_value' => 'DepreciateToResidualValue',
        'depreciation_final' => 'DepreciationFinal',
        'depreciation_method' => 'DepreciationMethod',
        'description' => 'Description',
        'group' => 'Group',
        'insured_number' => 'InsuredNumber',
        'insured_with' => 'InsuredWith',
        'notes' => 'Notes',
        'number' => 'Number',
        'placement' => 'Placement',
        'project' => 'Project',
        'reference' => 'Reference',
        'room' => 'Room',
        'type_id' => 'TypeId'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'acquisition_date' => 'setAcquisitionDate',
        'acquisition_start' => 'setAcquisitionStart',
        'acquisition_value' => 'setAcquisitionValue',
        'brand' => 'setBrand',
        'cost_center' => 'setCostCenter',
        'department' => 'setDepartment',
        'depreciate_to_residual_value' => 'setDepreciateToResidualValue',
        'depreciation_final' => 'setDepreciationFinal',
        'depreciation_method' => 'setDepreciationMethod',
        'description' => 'setDescription',
        'group' => 'setGroup',
        'insured_number' => 'setInsuredNumber',
        'insured_with' => 'setInsuredWith',
        'notes' => 'setNotes',
        'number' => 'setNumber',
        'placement' => 'setPlacement',
        'project' => 'setProject',
        'reference' => 'setReference',
        'room' => 'setRoom',
        'type_id' => 'setTypeId'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'acquisition_date' => 'getAcquisitionDate',
        'acquisition_start' => 'getAcquisitionStart',
        'acquisition_value' => 'getAcquisitionValue',
        'brand' => 'getBrand',
        'cost_center' => 'getCostCenter',
        'department' => 'getDepartment',
        'depreciate_to_residual_value' => 'getDepreciateToResidualValue',
        'depreciation_final' => 'getDepreciationFinal',
        'depreciation_method' => 'getDepreciationMethod',
        'description' => 'getDescription',
        'group' => 'getGroup',
        'insured_number' => 'getInsuredNumber',
        'insured_with' => 'getInsuredWith',
        'notes' => 'getNotes',
        'number' => 'getNumber',
        'placement' => 'getPlacement',
        'project' => 'getProject',
        'reference' => 'getReference',
        'room' => 'getRoom',
        'type_id' => 'getTypeId'
    ];

    /**
     * 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[]|null $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(?array $data = null)
    {
        $this->setIfExists('acquisition_date', $data ?? [], null);
        $this->setIfExists('acquisition_start', $data ?? [], null);
        $this->setIfExists('acquisition_value', $data ?? [], null);
        $this->setIfExists('brand', $data ?? [], null);
        $this->setIfExists('cost_center', $data ?? [], null);
        $this->setIfExists('department', $data ?? [], null);
        $this->setIfExists('depreciate_to_residual_value', $data ?? [], null);
        $this->setIfExists('depreciation_final', $data ?? [], null);
        $this->setIfExists('depreciation_method', $data ?? [], null);
        $this->setIfExists('description', $data ?? [], null);
        $this->setIfExists('group', $data ?? [], null);
        $this->setIfExists('insured_number', $data ?? [], null);
        $this->setIfExists('insured_with', $data ?? [], null);
        $this->setIfExists('notes', $data ?? [], null);
        $this->setIfExists('number', $data ?? [], null);
        $this->setIfExists('placement', $data ?? [], null);
        $this->setIfExists('project', $data ?? [], null);
        $this->setIfExists('reference', $data ?? [], null);
        $this->setIfExists('room', $data ?? [], null);
        $this->setIfExists('type_id', $data ?? [], null);
    }

    /**
    * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName
    * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the
    * $this->openAPINullablesSetToNull array
    *
    * @param string $variableName
    * @param array  $fields
    * @param mixed  $defaultValue
    */
    private function setIfExists(string $variableName, array $fields, $defaultValue): void
    {
        if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) {
            $this->openAPINullablesSetToNull[] = $variableName;
        }

        $this->container[$variableName] = $fields[$variableName] ?? $defaultValue;
    }

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

    /**
     * Sets acquisition_date
     *
     * @param string|null $acquisition_date acquisition_date
     *
     * @return self
     */
    public function setAcquisitionDate($acquisition_date)
    {
        if (is_null($acquisition_date)) {
            throw new \InvalidArgumentException('non-nullable acquisition_date cannot be null');
        }
        $this->container['acquisition_date'] = $acquisition_date;

        return $this;
    }

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

    /**
     * Sets acquisition_start
     *
     * @param string|null $acquisition_start acquisition_start
     *
     * @return self
     */
    public function setAcquisitionStart($acquisition_start)
    {
        if (is_null($acquisition_start)) {
            throw new \InvalidArgumentException('non-nullable acquisition_start cannot be null');
        }
        $this->container['acquisition_start'] = $acquisition_start;

        return $this;
    }

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

    /**
     * Sets acquisition_value
     *
     * @param string|null $acquisition_value acquisition_value
     *
     * @return self
     */
    public function setAcquisitionValue($acquisition_value)
    {
        if (is_null($acquisition_value)) {
            throw new \InvalidArgumentException('non-nullable acquisition_value cannot be null');
        }
        $this->container['acquisition_value'] = $acquisition_value;

        return $this;
    }

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

    /**
     * Sets brand
     *
     * @param string|null $brand brand
     *
     * @return self
     */
    public function setBrand($brand)
    {
        if (is_null($brand)) {
            throw new \InvalidArgumentException('non-nullable brand cannot be null');
        }
        $this->container['brand'] = $brand;

        return $this;
    }

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

    /**
     * Sets cost_center
     *
     * @param string|null $cost_center cost_center
     *
     * @return self
     */
    public function setCostCenter($cost_center)
    {
        if (is_null($cost_center)) {
            throw new \InvalidArgumentException('non-nullable cost_center cannot be null');
        }
        $this->container['cost_center'] = $cost_center;

        return $this;
    }

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

    /**
     * Sets department
     *
     * @param string|null $department department
     *
     * @return self
     */
    public function setDepartment($department)
    {
        if (is_null($department)) {
            throw new \InvalidArgumentException('non-nullable department cannot be null');
        }
        $this->container['department'] = $department;

        return $this;
    }

    /**
     * Gets depreciate_to_residual_value
     *
     * @return float|null
     */
    public function getDepreciateToResidualValue()
    {
        return $this->container['depreciate_to_residual_value'];
    }

    /**
     * Sets depreciate_to_residual_value
     *
     * @param float|null $depreciate_to_residual_value depreciate_to_residual_value
     *
     * @return self
     */
    public function setDepreciateToResidualValue($depreciate_to_residual_value)
    {
        if (is_null($depreciate_to_residual_value)) {
            throw new \InvalidArgumentException('non-nullable depreciate_to_residual_value cannot be null');
        }
        $this->container['depreciate_to_residual_value'] = $depreciate_to_residual_value;

        return $this;
    }

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

    /**
     * Sets depreciation_final
     *
     * @param string|null $depreciation_final depreciation_final
     *
     * @return self
     */
    public function setDepreciationFinal($depreciation_final)
    {
        if (is_null($depreciation_final)) {
            throw new \InvalidArgumentException('non-nullable depreciation_final cannot be null');
        }
        $this->container['depreciation_final'] = $depreciation_final;

        return $this;
    }

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

    /**
     * Sets depreciation_method
     *
     * @param string|null $depreciation_method depreciation_method
     *
     * @return self
     */
    public function setDepreciationMethod($depreciation_method)
    {
        if (is_null($depreciation_method)) {
            throw new \InvalidArgumentException('non-nullable depreciation_method cannot be null');
        }
        $this->container['depreciation_method'] = $depreciation_method;

        return $this;
    }

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

    /**
     * Sets description
     *
     * @param string|null $description description
     *
     * @return self
     */
    public function setDescription($description)
    {
        if (is_null($description)) {
            throw new \InvalidArgumentException('non-nullable description cannot be null');
        }
        $this->container['description'] = $description;

        return $this;
    }

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

    /**
     * Sets group
     *
     * @param string|null $group group
     *
     * @return self
     */
    public function setGroup($group)
    {
        if (is_null($group)) {
            throw new \InvalidArgumentException('non-nullable group cannot be null');
        }
        $this->container['group'] = $group;

        return $this;
    }

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

    /**
     * Sets insured_number
     *
     * @param string|null $insured_number insured_number
     *
     * @return self
     */
    public function setInsuredNumber($insured_number)
    {
        if (is_null($insured_number)) {
            throw new \InvalidArgumentException('non-nullable insured_number cannot be null');
        }
        $this->container['insured_number'] = $insured_number;

        return $this;
    }

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

    /**
     * Sets insured_with
     *
     * @param string|null $insured_with insured_with
     *
     * @return self
     */
    public function setInsuredWith($insured_with)
    {
        if (is_null($insured_with)) {
            throw new \InvalidArgumentException('non-nullable insured_with cannot be null');
        }
        $this->container['insured_with'] = $insured_with;

        return $this;
    }

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

    /**
     * Sets notes
     *
     * @param string|null $notes notes
     *
     * @return self
     */
    public function setNotes($notes)
    {
        if (is_null($notes)) {
            throw new \InvalidArgumentException('non-nullable notes cannot be null');
        }
        $this->container['notes'] = $notes;

        return $this;
    }

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

    /**
     * Sets number
     *
     * @param string|null $number number
     *
     * @return self
     */
    public function setNumber($number)
    {
        if (is_null($number)) {
            throw new \InvalidArgumentException('non-nullable number cannot be null');
        }
        $this->container['number'] = $number;

        return $this;
    }

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

    /**
     * Sets placement
     *
     * @param string|null $placement placement
     *
     * @return self
     */
    public function setPlacement($placement)
    {
        if (is_null($placement)) {
            throw new \InvalidArgumentException('non-nullable placement cannot be null');
        }
        $this->container['placement'] = $placement;

        return $this;
    }

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

    /**
     * Sets project
     *
     * @param string|null $project project
     *
     * @return self
     */
    public function setProject($project)
    {
        if (is_null($project)) {
            throw new \InvalidArgumentException('non-nullable project cannot be null');
        }
        $this->container['project'] = $project;

        return $this;
    }

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

    /**
     * Sets reference
     *
     * @param string|null $reference reference
     *
     * @return self
     */
    public function setReference($reference)
    {
        if (is_null($reference)) {
            throw new \InvalidArgumentException('non-nullable reference cannot be null');
        }
        $this->container['reference'] = $reference;

        return $this;
    }

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

    /**
     * Sets room
     *
     * @param string|null $room room
     *
     * @return self
     */
    public function setRoom($room)
    {
        if (is_null($room)) {
            throw new \InvalidArgumentException('non-nullable room cannot be null');
        }
        $this->container['room'] = $room;

        return $this;
    }

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

    /**
     * Sets type_id
     *
     * @param string|null $type_id type_id
     *
     * @return self
     */
    public function setTypeId($type_id)
    {
        if (is_null($type_id)) {
            throw new \InvalidArgumentException('non-nullable type_id cannot be null');
        }
        $this->container['type_id'] = $type_id;

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

    /**
     * Gets offset.
     *
     * @param integer|string $offset Offset
     *
     * @return mixed|null
     */
    #[\ReturnTypeWillChange]
    public function offsetGet(mixed $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|string $offset Offset
     *
     * @return void
     */
    public function offsetUnset(mixed $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));
    }
}


