<?php
/**
 * FortnoxContractInvoiceContractSingleItem
 *
 * 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;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'at_url' => 'string',
        'at_url_tax_reduction_list' => 'string',
        'active' => 'bool',
        'administration_fee' => 'float',
        'basis_tax_reduction' => 'float',
        'comments' => 'string',
        'continuous' => 'bool',
        'contract_date' => '\DateTime',
        'contract_length' => 'int',
        'contribution_percent' => 'float',
        'contribution_value' => 'float',
        'cost_center' => 'string',
        'currency' => 'string',
        'customer_name' => 'string',
        'customer_number' => 'string',
        'document_number' => 'int',
        'email_information' => '\Fortnox\Model\FortnoxDocumentEmailFieldSingleItem',
        'external_invoice_reference1' => 'string',
        'external_invoice_reference2' => 'string',
        'freight' => 'float',
        'gross' => 'float',
        'house_work' => 'bool',
        'invoice_discount' => 'float',
        'invoice_interval' => 'int',
        'invoice_rows' => '\Fortnox\Model\FortnoxContractInvoiceContractInvoiceRowSingleItem[]',
        'invoices_remaining' => 'string',
        'language' => 'string',
        'last_invoice_date' => 'string',
        'net' => 'float',
        'our_reference' => 'string',
        'period_end' => '\DateTime',
        'period_start' => '\DateTime',
        'price_list' => 'string',
        'print_template' => 'string',
        'project' => 'string',
        'remarks' => 'string',
        'round_off' => 'float',
        'tax_reduction' => 'float',
        'tax_reduction_type' => 'string',
        'template_name' => 'string',
        'template_number' => 'int',
        'terms_of_delivery' => 'string',
        'terms_of_payment' => 'string',
        'total' => 'float',
        'total_to_pay' => 'float',
        'total_vat' => 'float',
        'vat_included' => 'bool',
        'way_of_delivery' => 'string',
        'your_order_number' => 'string',
        'your_reference' => '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 = [
        'at_url' => null,
        'at_url_tax_reduction_list' => null,
        'active' => null,
        'administration_fee' => 'double',
        'basis_tax_reduction' => 'double',
        'comments' => null,
        'continuous' => null,
        'contract_date' => 'date',
        'contract_length' => 'int32',
        'contribution_percent' => 'double',
        'contribution_value' => 'double',
        'cost_center' => null,
        'currency' => null,
        'customer_name' => null,
        'customer_number' => null,
        'document_number' => 'int64',
        'email_information' => null,
        'external_invoice_reference1' => null,
        'external_invoice_reference2' => null,
        'freight' => 'double',
        'gross' => 'double',
        'house_work' => null,
        'invoice_discount' => 'double',
        'invoice_interval' => 'int32',
        'invoice_rows' => null,
        'invoices_remaining' => null,
        'language' => null,
        'last_invoice_date' => null,
        'net' => 'double',
        'our_reference' => null,
        'period_end' => 'date',
        'period_start' => 'date',
        'price_list' => null,
        'print_template' => null,
        'project' => null,
        'remarks' => null,
        'round_off' => 'double',
        'tax_reduction' => 'double',
        'tax_reduction_type' => null,
        'template_name' => null,
        'template_number' => 'int32',
        'terms_of_delivery' => null,
        'terms_of_payment' => null,
        'total' => 'double',
        'total_to_pay' => 'double',
        'total_vat' => 'double',
        'vat_included' => null,
        'way_of_delivery' => null,
        'your_order_number' => null,
        'your_reference' => null
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'at_url' => false,
        'at_url_tax_reduction_list' => false,
        'active' => false,
        'administration_fee' => false,
        'basis_tax_reduction' => false,
        'comments' => false,
        'continuous' => false,
        'contract_date' => false,
        'contract_length' => false,
        'contribution_percent' => false,
        'contribution_value' => false,
        'cost_center' => false,
        'currency' => false,
        'customer_name' => false,
        'customer_number' => false,
        'document_number' => false,
        'email_information' => false,
        'external_invoice_reference1' => false,
        'external_invoice_reference2' => false,
        'freight' => false,
        'gross' => false,
        'house_work' => false,
        'invoice_discount' => false,
        'invoice_interval' => false,
        'invoice_rows' => false,
        'invoices_remaining' => false,
        'language' => false,
        'last_invoice_date' => false,
        'net' => false,
        'our_reference' => false,
        'period_end' => false,
        'period_start' => false,
        'price_list' => false,
        'print_template' => false,
        'project' => false,
        'remarks' => false,
        'round_off' => false,
        'tax_reduction' => false,
        'tax_reduction_type' => false,
        'template_name' => false,
        'template_number' => false,
        'terms_of_delivery' => false,
        'terms_of_payment' => false,
        'total' => false,
        'total_to_pay' => false,
        'total_vat' => false,
        'vat_included' => false,
        'way_of_delivery' => false,
        'your_order_number' => false,
        'your_reference' => 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 = [
        'at_url' => '@url',
        'at_url_tax_reduction_list' => '@urlTaxReductionList',
        'active' => 'Active',
        'administration_fee' => 'AdministrationFee',
        'basis_tax_reduction' => 'BasisTaxReduction',
        'comments' => 'Comments',
        'continuous' => 'Continuous',
        'contract_date' => 'ContractDate',
        'contract_length' => 'ContractLength',
        'contribution_percent' => 'ContributionPercent',
        'contribution_value' => 'ContributionValue',
        'cost_center' => 'CostCenter',
        'currency' => 'Currency',
        'customer_name' => 'CustomerName',
        'customer_number' => 'CustomerNumber',
        'document_number' => 'DocumentNumber',
        'email_information' => 'EmailInformation',
        'external_invoice_reference1' => 'ExternalInvoiceReference1',
        'external_invoice_reference2' => 'ExternalInvoiceReference2',
        'freight' => 'Freight',
        'gross' => 'Gross',
        'house_work' => 'HouseWork',
        'invoice_discount' => 'InvoiceDiscount',
        'invoice_interval' => 'InvoiceInterval',
        'invoice_rows' => 'InvoiceRows',
        'invoices_remaining' => 'InvoicesRemaining',
        'language' => 'Language',
        'last_invoice_date' => 'LastInvoiceDate',
        'net' => 'Net',
        'our_reference' => 'OurReference',
        'period_end' => 'PeriodEnd',
        'period_start' => 'PeriodStart',
        'price_list' => 'PriceList',
        'print_template' => 'PrintTemplate',
        'project' => 'Project',
        'remarks' => 'Remarks',
        'round_off' => 'RoundOff',
        'tax_reduction' => 'TaxReduction',
        'tax_reduction_type' => 'TaxReductionType',
        'template_name' => 'TemplateName',
        'template_number' => 'TemplateNumber',
        'terms_of_delivery' => 'TermsOfDelivery',
        'terms_of_payment' => 'TermsOfPayment',
        'total' => 'Total',
        'total_to_pay' => 'TotalToPay',
        'total_vat' => 'TotalVAT',
        'vat_included' => 'VATIncluded',
        'way_of_delivery' => 'WayOfDelivery',
        'your_order_number' => 'YourOrderNumber',
        'your_reference' => 'YourReference'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'at_url' => 'setAtUrl',
        'at_url_tax_reduction_list' => 'setAtUrlTaxReductionList',
        'active' => 'setActive',
        'administration_fee' => 'setAdministrationFee',
        'basis_tax_reduction' => 'setBasisTaxReduction',
        'comments' => 'setComments',
        'continuous' => 'setContinuous',
        'contract_date' => 'setContractDate',
        'contract_length' => 'setContractLength',
        'contribution_percent' => 'setContributionPercent',
        'contribution_value' => 'setContributionValue',
        'cost_center' => 'setCostCenter',
        'currency' => 'setCurrency',
        'customer_name' => 'setCustomerName',
        'customer_number' => 'setCustomerNumber',
        'document_number' => 'setDocumentNumber',
        'email_information' => 'setEmailInformation',
        'external_invoice_reference1' => 'setExternalInvoiceReference1',
        'external_invoice_reference2' => 'setExternalInvoiceReference2',
        'freight' => 'setFreight',
        'gross' => 'setGross',
        'house_work' => 'setHouseWork',
        'invoice_discount' => 'setInvoiceDiscount',
        'invoice_interval' => 'setInvoiceInterval',
        'invoice_rows' => 'setInvoiceRows',
        'invoices_remaining' => 'setInvoicesRemaining',
        'language' => 'setLanguage',
        'last_invoice_date' => 'setLastInvoiceDate',
        'net' => 'setNet',
        'our_reference' => 'setOurReference',
        'period_end' => 'setPeriodEnd',
        'period_start' => 'setPeriodStart',
        'price_list' => 'setPriceList',
        'print_template' => 'setPrintTemplate',
        'project' => 'setProject',
        'remarks' => 'setRemarks',
        'round_off' => 'setRoundOff',
        'tax_reduction' => 'setTaxReduction',
        'tax_reduction_type' => 'setTaxReductionType',
        'template_name' => 'setTemplateName',
        'template_number' => 'setTemplateNumber',
        'terms_of_delivery' => 'setTermsOfDelivery',
        'terms_of_payment' => 'setTermsOfPayment',
        'total' => 'setTotal',
        'total_to_pay' => 'setTotalToPay',
        'total_vat' => 'setTotalVat',
        'vat_included' => 'setVatIncluded',
        'way_of_delivery' => 'setWayOfDelivery',
        'your_order_number' => 'setYourOrderNumber',
        'your_reference' => 'setYourReference'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'at_url' => 'getAtUrl',
        'at_url_tax_reduction_list' => 'getAtUrlTaxReductionList',
        'active' => 'getActive',
        'administration_fee' => 'getAdministrationFee',
        'basis_tax_reduction' => 'getBasisTaxReduction',
        'comments' => 'getComments',
        'continuous' => 'getContinuous',
        'contract_date' => 'getContractDate',
        'contract_length' => 'getContractLength',
        'contribution_percent' => 'getContributionPercent',
        'contribution_value' => 'getContributionValue',
        'cost_center' => 'getCostCenter',
        'currency' => 'getCurrency',
        'customer_name' => 'getCustomerName',
        'customer_number' => 'getCustomerNumber',
        'document_number' => 'getDocumentNumber',
        'email_information' => 'getEmailInformation',
        'external_invoice_reference1' => 'getExternalInvoiceReference1',
        'external_invoice_reference2' => 'getExternalInvoiceReference2',
        'freight' => 'getFreight',
        'gross' => 'getGross',
        'house_work' => 'getHouseWork',
        'invoice_discount' => 'getInvoiceDiscount',
        'invoice_interval' => 'getInvoiceInterval',
        'invoice_rows' => 'getInvoiceRows',
        'invoices_remaining' => 'getInvoicesRemaining',
        'language' => 'getLanguage',
        'last_invoice_date' => 'getLastInvoiceDate',
        'net' => 'getNet',
        'our_reference' => 'getOurReference',
        'period_end' => 'getPeriodEnd',
        'period_start' => 'getPeriodStart',
        'price_list' => 'getPriceList',
        'print_template' => 'getPrintTemplate',
        'project' => 'getProject',
        'remarks' => 'getRemarks',
        'round_off' => 'getRoundOff',
        'tax_reduction' => 'getTaxReduction',
        'tax_reduction_type' => 'getTaxReductionType',
        'template_name' => 'getTemplateName',
        'template_number' => 'getTemplateNumber',
        'terms_of_delivery' => 'getTermsOfDelivery',
        'terms_of_payment' => 'getTermsOfPayment',
        'total' => 'getTotal',
        'total_to_pay' => 'getTotalToPay',
        'total_vat' => 'getTotalVat',
        'vat_included' => 'getVatIncluded',
        'way_of_delivery' => 'getWayOfDelivery',
        'your_order_number' => 'getYourOrderNumber',
        'your_reference' => 'getYourReference'
    ];

    /**
     * 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 LANGUAGE_SV = 'SV';
    public const LANGUAGE_EN = 'EN';
    public const TAX_REDUCTION_TYPE_NONE = 'none';
    public const TAX_REDUCTION_TYPE_ROT = 'rot';
    public const TAX_REDUCTION_TYPE_RUT = 'rut';
    public const TAX_REDUCTION_TYPE_GREEN = 'green';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getLanguageAllowableValues()
    {
        return [
            self::LANGUAGE_SV,
            self::LANGUAGE_EN,
        ];
    }

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getTaxReductionTypeAllowableValues()
    {
        return [
            self::TAX_REDUCTION_TYPE_NONE,
            self::TAX_REDUCTION_TYPE_ROT,
            self::TAX_REDUCTION_TYPE_RUT,
            self::TAX_REDUCTION_TYPE_GREEN,
        ];
    }

    /**
     * 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('at_url', $data ?? [], null);
        $this->setIfExists('at_url_tax_reduction_list', $data ?? [], null);
        $this->setIfExists('active', $data ?? [], null);
        $this->setIfExists('administration_fee', $data ?? [], null);
        $this->setIfExists('basis_tax_reduction', $data ?? [], null);
        $this->setIfExists('comments', $data ?? [], null);
        $this->setIfExists('continuous', $data ?? [], null);
        $this->setIfExists('contract_date', $data ?? [], null);
        $this->setIfExists('contract_length', $data ?? [], null);
        $this->setIfExists('contribution_percent', $data ?? [], null);
        $this->setIfExists('contribution_value', $data ?? [], null);
        $this->setIfExists('cost_center', $data ?? [], null);
        $this->setIfExists('currency', $data ?? [], null);
        $this->setIfExists('customer_name', $data ?? [], null);
        $this->setIfExists('customer_number', $data ?? [], null);
        $this->setIfExists('document_number', $data ?? [], null);
        $this->setIfExists('email_information', $data ?? [], null);
        $this->setIfExists('external_invoice_reference1', $data ?? [], null);
        $this->setIfExists('external_invoice_reference2', $data ?? [], null);
        $this->setIfExists('freight', $data ?? [], null);
        $this->setIfExists('gross', $data ?? [], null);
        $this->setIfExists('house_work', $data ?? [], null);
        $this->setIfExists('invoice_discount', $data ?? [], null);
        $this->setIfExists('invoice_interval', $data ?? [], null);
        $this->setIfExists('invoice_rows', $data ?? [], null);
        $this->setIfExists('invoices_remaining', $data ?? [], null);
        $this->setIfExists('language', $data ?? [], null);
        $this->setIfExists('last_invoice_date', $data ?? [], null);
        $this->setIfExists('net', $data ?? [], null);
        $this->setIfExists('our_reference', $data ?? [], null);
        $this->setIfExists('period_end', $data ?? [], null);
        $this->setIfExists('period_start', $data ?? [], null);
        $this->setIfExists('price_list', $data ?? [], null);
        $this->setIfExists('print_template', $data ?? [], null);
        $this->setIfExists('project', $data ?? [], null);
        $this->setIfExists('remarks', $data ?? [], null);
        $this->setIfExists('round_off', $data ?? [], null);
        $this->setIfExists('tax_reduction', $data ?? [], null);
        $this->setIfExists('tax_reduction_type', $data ?? [], null);
        $this->setIfExists('template_name', $data ?? [], null);
        $this->setIfExists('template_number', $data ?? [], null);
        $this->setIfExists('terms_of_delivery', $data ?? [], null);
        $this->setIfExists('terms_of_payment', $data ?? [], null);
        $this->setIfExists('total', $data ?? [], null);
        $this->setIfExists('total_to_pay', $data ?? [], null);
        $this->setIfExists('total_vat', $data ?? [], null);
        $this->setIfExists('vat_included', $data ?? [], null);
        $this->setIfExists('way_of_delivery', $data ?? [], null);
        $this->setIfExists('your_order_number', $data ?? [], null);
        $this->setIfExists('your_reference', $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 = [];

        if (!is_null($this->container['comments']) && (mb_strlen($this->container['comments']) > 1024)) {
            $invalidProperties[] = "invalid value for 'comments', the character length must be smaller than or equal to 1024.";
        }

        if (!is_null($this->container['customer_name']) && (mb_strlen($this->container['customer_name']) > 1024)) {
            $invalidProperties[] = "invalid value for 'customer_name', the character length must be smaller than or equal to 1024.";
        }

        if ($this->container['customer_number'] === null) {
            $invalidProperties[] = "'customer_number' can't be null";
        }
        if (!is_null($this->container['freight']) && ($this->container['freight'] > 9999999999)) {
            $invalidProperties[] = "invalid value for 'freight', must be smaller than or equal to 9999999999.";
        }

        if (!is_null($this->container['freight']) && ($this->container['freight'] < -9999999999)) {
            $invalidProperties[] = "invalid value for 'freight', must be bigger than or equal to -9999999999.";
        }

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

        if (!is_null($this->container['our_reference']) && (mb_strlen($this->container['our_reference']) > 25)) {
            $invalidProperties[] = "invalid value for 'our_reference', the character length must be smaller than or equal to 25.";
        }

        if ($this->container['period_end'] === null) {
            $invalidProperties[] = "'period_end' can't be null";
        }
        if (!is_null($this->container['remarks']) && (mb_strlen($this->container['remarks']) > 1024)) {
            $invalidProperties[] = "invalid value for 'remarks', the character length must be smaller than or equal to 1024.";
        }

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

        if (!is_null($this->container['total']) && ($this->container['total'] > 9999999999)) {
            $invalidProperties[] = "invalid value for 'total', must be smaller than or equal to 9999999999.";
        }

        if (!is_null($this->container['total']) && ($this->container['total'] < -999999999)) {
            $invalidProperties[] = "invalid value for 'total', must be bigger than or equal to -999999999.";
        }

        if (!is_null($this->container['your_order_number']) && (mb_strlen($this->container['your_order_number']) > 75)) {
            $invalidProperties[] = "invalid value for 'your_order_number', the character length must be smaller than or equal to 75.";
        }

        if (!is_null($this->container['your_reference']) && (mb_strlen($this->container['your_reference']) > 50)) {
            $invalidProperties[] = "invalid value for 'your_reference', the character length must be smaller than or equal to 50.";
        }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets active
     *
     * @return bool|null
     */
    public function getActive()
    {
        return $this->container['active'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets comments
     *
     * @param string|null $comments comments
     *
     * @return self
     */
    public function setComments($comments)
    {
        if (is_null($comments)) {
            throw new \InvalidArgumentException('non-nullable comments cannot be null');
        }
        if ((mb_strlen($comments) > 1024)) {
            throw new \InvalidArgumentException('invalid length for $comments when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 1024.');
        }

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

        return $this;
    }

    /**
     * Gets continuous
     *
     * @return bool|null
     */
    public function getContinuous()
    {
        return $this->container['continuous'];
    }

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

        return $this;
    }

    /**
     * Gets contract_date
     *
     * @return \DateTime|null
     */
    public function getContractDate()
    {
        return $this->container['contract_date'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

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

        return $this;
    }

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

    /**
     * Sets customer_name
     *
     * @param string|null $customer_name customer_name
     *
     * @return self
     */
    public function setCustomerName($customer_name)
    {
        if (is_null($customer_name)) {
            throw new \InvalidArgumentException('non-nullable customer_name cannot be null');
        }
        if ((mb_strlen($customer_name) > 1024)) {
            throw new \InvalidArgumentException('invalid length for $customer_name when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 1024.');
        }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets email_information
     *
     * @return \Fortnox\Model\FortnoxDocumentEmailFieldSingleItem|null
     */
    public function getEmailInformation()
    {
        return $this->container['email_information'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets freight
     *
     * @param float|null $freight freight
     *
     * @return self
     */
    public function setFreight($freight)
    {
        if (is_null($freight)) {
            throw new \InvalidArgumentException('non-nullable freight cannot be null');
        }

        if (($freight > 9999999999)) {
            throw new \InvalidArgumentException('invalid value for $freight when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 9999999999.');
        }
        if (($freight < -9999999999)) {
            throw new \InvalidArgumentException('invalid value for $freight when calling FortnoxContractInvoiceContractSingleItem., must be bigger than or equal to -9999999999.');
        }

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets house_work
     *
     * @return bool|null
     */
    public function getHouseWork()
    {
        return $this->container['house_work'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets invoice_rows
     *
     * @return \Fortnox\Model\FortnoxContractInvoiceContractInvoiceRowSingleItem[]
     */
    public function getInvoiceRows()
    {
        return $this->container['invoice_rows'];
    }

    /**
     * Sets invoice_rows
     *
     * @param \Fortnox\Model\FortnoxContractInvoiceContractInvoiceRowSingleItem[] $invoice_rows invoice_rows
     *
     * @return self
     */
    public function setInvoiceRows($invoice_rows)
    {
        if (is_null($invoice_rows)) {
            throw new \InvalidArgumentException('non-nullable invoice_rows cannot be null');
        }
        $this->container['invoice_rows'] = $invoice_rows;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets language
     *
     * @param string|null $language language
     *
     * @return self
     */
    public function setLanguage($language)
    {
        if (is_null($language)) {
            throw new \InvalidArgumentException('non-nullable language cannot be null');
        }
        $allowedValues = $this->getLanguageAllowableValues();
        if (!in_array($language, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'language', must be one of '%s'",
                    $language,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['language'] = $language;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets our_reference
     *
     * @param string|null $our_reference our_reference
     *
     * @return self
     */
    public function setOurReference($our_reference)
    {
        if (is_null($our_reference)) {
            throw new \InvalidArgumentException('non-nullable our_reference cannot be null');
        }
        if ((mb_strlen($our_reference) > 25)) {
            throw new \InvalidArgumentException('invalid length for $our_reference when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 25.');
        }

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

        return $this;
    }

    /**
     * Gets period_end
     *
     * @return \DateTime
     */
    public function getPeriodEnd()
    {
        return $this->container['period_end'];
    }

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

        return $this;
    }

    /**
     * Gets period_start
     *
     * @return \DateTime|null
     */
    public function getPeriodStart()
    {
        return $this->container['period_start'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

    /**
     * Sets remarks
     *
     * @param string|null $remarks remarks
     *
     * @return self
     */
    public function setRemarks($remarks)
    {
        if (is_null($remarks)) {
            throw new \InvalidArgumentException('non-nullable remarks cannot be null');
        }
        if ((mb_strlen($remarks) > 1024)) {
            throw new \InvalidArgumentException('invalid length for $remarks when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 1024.');
        }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets tax_reduction_type
     *
     * @param string|null $tax_reduction_type tax_reduction_type
     *
     * @return self
     */
    public function setTaxReductionType($tax_reduction_type)
    {
        if (is_null($tax_reduction_type)) {
            throw new \InvalidArgumentException('non-nullable tax_reduction_type cannot be null');
        }
        $allowedValues = $this->getTaxReductionTypeAllowableValues();
        if (!in_array($tax_reduction_type, $allowedValues, true)) {
            throw new \InvalidArgumentException(
                sprintf(
                    "Invalid value '%s' for 'tax_reduction_type', must be one of '%s'",
                    $tax_reduction_type,
                    implode("', '", $allowedValues)
                )
            );
        }
        $this->container['tax_reduction_type'] = $tax_reduction_type;

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets total
     *
     * @param float|null $total total
     *
     * @return self
     */
    public function setTotal($total)
    {
        if (is_null($total)) {
            throw new \InvalidArgumentException('non-nullable total cannot be null');
        }

        if (($total > 9999999999)) {
            throw new \InvalidArgumentException('invalid value for $total when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 9999999999.');
        }
        if (($total < -999999999)) {
            throw new \InvalidArgumentException('invalid value for $total when calling FortnoxContractInvoiceContractSingleItem., must be bigger than or equal to -999999999.');
        }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets vat_included
     *
     * @return bool|null
     */
    public function getVatIncluded()
    {
        return $this->container['vat_included'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets your_order_number
     *
     * @param string|null $your_order_number your_order_number
     *
     * @return self
     */
    public function setYourOrderNumber($your_order_number)
    {
        if (is_null($your_order_number)) {
            throw new \InvalidArgumentException('non-nullable your_order_number cannot be null');
        }
        if ((mb_strlen($your_order_number) > 75)) {
            throw new \InvalidArgumentException('invalid length for $your_order_number when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 75.');
        }

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

        return $this;
    }

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

    /**
     * Sets your_reference
     *
     * @param string|null $your_reference your_reference
     *
     * @return self
     */
    public function setYourReference($your_reference)
    {
        if (is_null($your_reference)) {
            throw new \InvalidArgumentException('non-nullable your_reference cannot be null');
        }
        if ((mb_strlen($your_reference) > 50)) {
            throw new \InvalidArgumentException('invalid length for $your_reference when calling FortnoxContractInvoiceContractSingleItem., must be smaller than or equal to 50.');
        }

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

        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));
    }
}


