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

/**
 * OmsorgCore.Api
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.14.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 OmsorgCoreClient\Model;

use \ArrayAccess;
use \OmsorgCoreClient\ObjectSerializer;

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'contract_type' => 'string',
        'employee_id' => 'string',
        'facility_id' => 'string',
        'start_date' => '\DateTime',
        'end_date' => '\DateTime',
        'status' => 'string',
        'weekly_hours' => 'float',
        'hourly_wage' => 'float',
        'allowances_description' => 'string',
        'overtime_rules' => 'string',
        'vacation_days_per_year' => 'int',
        'probation_period_months' => 'int'
    ];

    /**
      * 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 = [
        'contract_type' => null,
        'employee_id' => 'uuid',
        'facility_id' => 'uuid',
        'start_date' => 'date',
        'end_date' => 'date',
        'status' => null,
        'weekly_hours' => 'double',
        'hourly_wage' => 'double',
        'allowances_description' => null,
        'overtime_rules' => null,
        'vacation_days_per_year' => 'int32',
        'probation_period_months' => 'int32'
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'contract_type' => true,
        'employee_id' => true,
        'facility_id' => true,
        'start_date' => false,
        'end_date' => true,
        'status' => true,
        'weekly_hours' => true,
        'hourly_wage' => true,
        'allowances_description' => true,
        'overtime_rules' => true,
        'vacation_days_per_year' => true,
        'probation_period_months' => true
    ];

    /**
      * 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 = [
        'contract_type' => 'contractType',
        'employee_id' => 'employeeId',
        'facility_id' => 'facilityId',
        'start_date' => 'startDate',
        'end_date' => 'endDate',
        'status' => 'status',
        'weekly_hours' => 'weeklyHours',
        'hourly_wage' => 'hourlyWage',
        'allowances_description' => 'allowancesDescription',
        'overtime_rules' => 'overtimeRules',
        'vacation_days_per_year' => 'vacationDaysPerYear',
        'probation_period_months' => 'probationPeriodMonths'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'contract_type' => 'setContractType',
        'employee_id' => 'setEmployeeId',
        'facility_id' => 'setFacilityId',
        'start_date' => 'setStartDate',
        'end_date' => 'setEndDate',
        'status' => 'setStatus',
        'weekly_hours' => 'setWeeklyHours',
        'hourly_wage' => 'setHourlyWage',
        'allowances_description' => 'setAllowancesDescription',
        'overtime_rules' => 'setOvertimeRules',
        'vacation_days_per_year' => 'setVacationDaysPerYear',
        'probation_period_months' => 'setProbationPeriodMonths'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'contract_type' => 'getContractType',
        'employee_id' => 'getEmployeeId',
        'facility_id' => 'getFacilityId',
        'start_date' => 'getStartDate',
        'end_date' => 'getEndDate',
        'status' => 'getStatus',
        'weekly_hours' => 'getWeeklyHours',
        'hourly_wage' => 'getHourlyWage',
        'allowances_description' => 'getAllowancesDescription',
        'overtime_rules' => 'getOvertimeRules',
        'vacation_days_per_year' => 'getVacationDaysPerYear',
        'probation_period_months' => 'getProbationPeriodMonths'
    ];

    /**
     * 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('contract_type', $data ?? [], null);
        $this->setIfExists('employee_id', $data ?? [], null);
        $this->setIfExists('facility_id', $data ?? [], null);
        $this->setIfExists('start_date', $data ?? [], null);
        $this->setIfExists('end_date', $data ?? [], null);
        $this->setIfExists('status', $data ?? [], null);
        $this->setIfExists('weekly_hours', $data ?? [], null);
        $this->setIfExists('hourly_wage', $data ?? [], null);
        $this->setIfExists('allowances_description', $data ?? [], null);
        $this->setIfExists('overtime_rules', $data ?? [], null);
        $this->setIfExists('vacation_days_per_year', $data ?? [], null);
        $this->setIfExists('probation_period_months', $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 contract_type
     *
     * @return string|null
     */
    public function getContractType()
    {
        return $this->container['contract_type'];
    }

    /**
     * Sets contract_type
     *
     * @param string|null $contract_type contract_type
     *
     * @return self
     */
    public function setContractType($contract_type)
    {
        if (is_null($contract_type)) {
            array_push($this->openAPINullablesSetToNull, 'contract_type');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('contract_type', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['contract_type'] = $contract_type;

        return $this;
    }

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

    /**
     * Sets employee_id
     *
     * @param string|null $employee_id employee_id
     *
     * @return self
     */
    public function setEmployeeId($employee_id)
    {
        if (is_null($employee_id)) {
            array_push($this->openAPINullablesSetToNull, 'employee_id');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('employee_id', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['employee_id'] = $employee_id;

        return $this;
    }

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

    /**
     * Sets facility_id
     *
     * @param string|null $facility_id facility_id
     *
     * @return self
     */
    public function setFacilityId($facility_id)
    {
        if (is_null($facility_id)) {
            array_push($this->openAPINullablesSetToNull, 'facility_id');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('facility_id', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['facility_id'] = $facility_id;

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets end_date
     *
     * @param \DateTime|null $end_date end_date
     *
     * @return self
     */
    public function setEndDate($end_date)
    {
        if (is_null($end_date)) {
            array_push($this->openAPINullablesSetToNull, 'end_date');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('end_date', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['end_date'] = $end_date;

        return $this;
    }

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

    /**
     * Sets status
     *
     * @param string|null $status status
     *
     * @return self
     */
    public function setStatus($status)
    {
        if (is_null($status)) {
            array_push($this->openAPINullablesSetToNull, 'status');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('status', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['status'] = $status;

        return $this;
    }

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

    /**
     * Sets weekly_hours
     *
     * @param float|null $weekly_hours weekly_hours
     *
     * @return self
     */
    public function setWeeklyHours($weekly_hours)
    {
        if (is_null($weekly_hours)) {
            array_push($this->openAPINullablesSetToNull, 'weekly_hours');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('weekly_hours', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['weekly_hours'] = $weekly_hours;

        return $this;
    }

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

    /**
     * Sets hourly_wage
     *
     * @param float|null $hourly_wage hourly_wage
     *
     * @return self
     */
    public function setHourlyWage($hourly_wage)
    {
        if (is_null($hourly_wage)) {
            array_push($this->openAPINullablesSetToNull, 'hourly_wage');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('hourly_wage', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['hourly_wage'] = $hourly_wage;

        return $this;
    }

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

    /**
     * Sets allowances_description
     *
     * @param string|null $allowances_description allowances_description
     *
     * @return self
     */
    public function setAllowancesDescription($allowances_description)
    {
        if (is_null($allowances_description)) {
            array_push($this->openAPINullablesSetToNull, 'allowances_description');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('allowances_description', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['allowances_description'] = $allowances_description;

        return $this;
    }

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

    /**
     * Sets overtime_rules
     *
     * @param string|null $overtime_rules overtime_rules
     *
     * @return self
     */
    public function setOvertimeRules($overtime_rules)
    {
        if (is_null($overtime_rules)) {
            array_push($this->openAPINullablesSetToNull, 'overtime_rules');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('overtime_rules', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['overtime_rules'] = $overtime_rules;

        return $this;
    }

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

    /**
     * Sets vacation_days_per_year
     *
     * @param int|null $vacation_days_per_year vacation_days_per_year
     *
     * @return self
     */
    public function setVacationDaysPerYear($vacation_days_per_year)
    {
        if (is_null($vacation_days_per_year)) {
            array_push($this->openAPINullablesSetToNull, 'vacation_days_per_year');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('vacation_days_per_year', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['vacation_days_per_year'] = $vacation_days_per_year;

        return $this;
    }

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

    /**
     * Sets probation_period_months
     *
     * @param int|null $probation_period_months probation_period_months
     *
     * @return self
     */
    public function setProbationPeriodMonths($probation_period_months)
    {
        if (is_null($probation_period_months)) {
            array_push($this->openAPINullablesSetToNull, 'probation_period_months');
        } else {
            $nullablesSetToNull = $this->getOpenAPINullablesSetToNull();
            $index = array_search('probation_period_months', $nullablesSetToNull);
            if ($index !== FALSE) {
                unset($nullablesSetToNull[$index]);
                $this->setOpenAPINullablesSetToNull($nullablesSetToNull);
            }
        }
        $this->container['probation_period_months'] = $probation_period_months;

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

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


