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

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'days_earned' => 'float',
        'days_saved' => 'float',
        'days_unused' => 'float',
        'debt_advance' => 'float',
        'debt_earned' => 'float',
        'debt_saved' => 'float',
        'debt_unused' => 'float',
        'employee_id' => 'string',
        'employee_name' => 'string',
        'total_debt_employee' => 'float',
        'total_debt_employer_contribution' => 'float',
        'variable_earned' => 'float',
        'variable_unused' => 'float',
        'wage_earned' => 'float',
        'wage_saved' => 'float',
        'wage_unused' => 'float'
    ];

    /**
      * 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 = [
        'days_earned' => 'double',
        'days_saved' => 'double',
        'days_unused' => 'double',
        'debt_advance' => 'double',
        'debt_earned' => 'double',
        'debt_saved' => 'double',
        'debt_unused' => 'double',
        'employee_id' => null,
        'employee_name' => null,
        'total_debt_employee' => 'double',
        'total_debt_employer_contribution' => 'double',
        'variable_earned' => 'double',
        'variable_unused' => 'double',
        'wage_earned' => 'double',
        'wage_saved' => 'double',
        'wage_unused' => 'double'
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'days_earned' => false,
        'days_saved' => false,
        'days_unused' => false,
        'debt_advance' => false,
        'debt_earned' => false,
        'debt_saved' => false,
        'debt_unused' => false,
        'employee_id' => false,
        'employee_name' => false,
        'total_debt_employee' => false,
        'total_debt_employer_contribution' => false,
        'variable_earned' => false,
        'variable_unused' => false,
        'wage_earned' => false,
        'wage_saved' => false,
        'wage_unused' => 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 = [
        'days_earned' => 'DaysEarned',
        'days_saved' => 'DaysSaved',
        'days_unused' => 'DaysUnused',
        'debt_advance' => 'DebtAdvance',
        'debt_earned' => 'DebtEarned',
        'debt_saved' => 'DebtSaved',
        'debt_unused' => 'DebtUnused',
        'employee_id' => 'EmployeeId',
        'employee_name' => 'EmployeeName',
        'total_debt_employee' => 'TotalDebtEmployee',
        'total_debt_employer_contribution' => 'TotalDebtEmployerContribution',
        'variable_earned' => 'VariableEarned',
        'variable_unused' => 'VariableUnused',
        'wage_earned' => 'WageEarned',
        'wage_saved' => 'WageSaved',
        'wage_unused' => 'WageUnused'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'days_earned' => 'setDaysEarned',
        'days_saved' => 'setDaysSaved',
        'days_unused' => 'setDaysUnused',
        'debt_advance' => 'setDebtAdvance',
        'debt_earned' => 'setDebtEarned',
        'debt_saved' => 'setDebtSaved',
        'debt_unused' => 'setDebtUnused',
        'employee_id' => 'setEmployeeId',
        'employee_name' => 'setEmployeeName',
        'total_debt_employee' => 'setTotalDebtEmployee',
        'total_debt_employer_contribution' => 'setTotalDebtEmployerContribution',
        'variable_earned' => 'setVariableEarned',
        'variable_unused' => 'setVariableUnused',
        'wage_earned' => 'setWageEarned',
        'wage_saved' => 'setWageSaved',
        'wage_unused' => 'setWageUnused'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'days_earned' => 'getDaysEarned',
        'days_saved' => 'getDaysSaved',
        'days_unused' => 'getDaysUnused',
        'debt_advance' => 'getDebtAdvance',
        'debt_earned' => 'getDebtEarned',
        'debt_saved' => 'getDebtSaved',
        'debt_unused' => 'getDebtUnused',
        'employee_id' => 'getEmployeeId',
        'employee_name' => 'getEmployeeName',
        'total_debt_employee' => 'getTotalDebtEmployee',
        'total_debt_employer_contribution' => 'getTotalDebtEmployerContribution',
        'variable_earned' => 'getVariableEarned',
        'variable_unused' => 'getVariableUnused',
        'wage_earned' => 'getWageEarned',
        'wage_saved' => 'getWageSaved',
        'wage_unused' => 'getWageUnused'
    ];

    /**
     * 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('days_earned', $data ?? [], null);
        $this->setIfExists('days_saved', $data ?? [], null);
        $this->setIfExists('days_unused', $data ?? [], null);
        $this->setIfExists('debt_advance', $data ?? [], null);
        $this->setIfExists('debt_earned', $data ?? [], null);
        $this->setIfExists('debt_saved', $data ?? [], null);
        $this->setIfExists('debt_unused', $data ?? [], null);
        $this->setIfExists('employee_id', $data ?? [], null);
        $this->setIfExists('employee_name', $data ?? [], null);
        $this->setIfExists('total_debt_employee', $data ?? [], null);
        $this->setIfExists('total_debt_employer_contribution', $data ?? [], null);
        $this->setIfExists('variable_earned', $data ?? [], null);
        $this->setIfExists('variable_unused', $data ?? [], null);
        $this->setIfExists('wage_earned', $data ?? [], null);
        $this->setIfExists('wage_saved', $data ?? [], null);
        $this->setIfExists('wage_unused', $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 ($this->container['employee_id'] === null) {
            $invalidProperties[] = "'employee_id' can't be null";
        }
        if ((mb_strlen($this->container['employee_id']) > 15)) {
            $invalidProperties[] = "invalid value for 'employee_id', the character length must be smaller than or equal to 15.";
        }

        if ((mb_strlen($this->container['employee_id']) < 1)) {
            $invalidProperties[] = "invalid value for 'employee_id', the character length must be bigger than or equal to 1.";
        }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets employee_id
     *
     * @param string $employee_id employee_id
     *
     * @return self
     */
    public function setEmployeeId($employee_id)
    {
        if (is_null($employee_id)) {
            throw new \InvalidArgumentException('non-nullable employee_id cannot be null');
        }
        if ((mb_strlen($employee_id) > 15)) {
            throw new \InvalidArgumentException('invalid length for $employee_id when calling FortnoxVacationDebtBasisVacationDebtBasisEmployeeSingleItem., must be smaller than or equal to 15.');
        }
        if ((mb_strlen($employee_id) < 1)) {
            throw new \InvalidArgumentException('invalid length for $employee_id when calling FortnoxVacationDebtBasisVacationDebtBasisEmployeeSingleItem., must be bigger than or equal to 1.');
        }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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


