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

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'charge_hours' => 'float',
        'child_id' => 'string',
        'cost_center' => '\Fortnox\Model\TimeReportingTRCostCenter',
        'created_by' => 'string',
        'created_time' => '\DateTime',
        'customer' => '\Fortnox\Model\TimeReportingTRCustomer',
        'document_id' => 'int',
        'document_type' => 'string',
        'id' => 'string',
        'invoice_basis_id' => 'int',
        'invoice_text' => 'string',
        'non_invoiceable' => 'bool',
        'note' => 'string',
        'project' => '\Fortnox\Model\TimeReportingTRProject',
        'registration_code' => '\Fortnox\Model\TimeReportingRegistrationCode',
        'service' => '\Fortnox\Model\TimeReportingTRItem',
        'start_time' => '\DateTime',
        'stop_time' => '\DateTime',
        'unit_cost' => 'float',
        'unit_price' => 'float',
        'updated_by' => 'string',
        'user_id' => 'string',
        'worked_date' => '\DateTime',
        'worked_hours' => '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 = [
        'charge_hours' => 'float',
        'child_id' => 'uuid',
        'cost_center' => null,
        'created_by' => null,
        'created_time' => 'date-time',
        'customer' => null,
        'document_id' => 'int64',
        'document_type' => null,
        'id' => 'uuid',
        'invoice_basis_id' => 'int64',
        'invoice_text' => null,
        'non_invoiceable' => null,
        'note' => null,
        'project' => null,
        'registration_code' => null,
        'service' => null,
        'start_time' => 'date-time',
        'stop_time' => 'date-time',
        'unit_cost' => null,
        'unit_price' => null,
        'updated_by' => null,
        'user_id' => null,
        'worked_date' => 'date',
        'worked_hours' => 'float'
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'charge_hours' => false,
        'child_id' => false,
        'cost_center' => false,
        'created_by' => false,
        'created_time' => false,
        'customer' => false,
        'document_id' => false,
        'document_type' => false,
        'id' => false,
        'invoice_basis_id' => false,
        'invoice_text' => false,
        'non_invoiceable' => false,
        'note' => false,
        'project' => false,
        'registration_code' => false,
        'service' => false,
        'start_time' => false,
        'stop_time' => false,
        'unit_cost' => false,
        'unit_price' => false,
        'updated_by' => false,
        'user_id' => false,
        'worked_date' => false,
        'worked_hours' => 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 = [
        'charge_hours' => 'chargeHours',
        'child_id' => 'childId',
        'cost_center' => 'costCenter',
        'created_by' => 'createdBy',
        'created_time' => 'createdTime',
        'customer' => 'customer',
        'document_id' => 'documentId',
        'document_type' => 'documentType',
        'id' => 'id',
        'invoice_basis_id' => 'invoiceBasisId',
        'invoice_text' => 'invoiceText',
        'non_invoiceable' => 'nonInvoiceable',
        'note' => 'note',
        'project' => 'project',
        'registration_code' => 'registrationCode',
        'service' => 'service',
        'start_time' => 'startTime',
        'stop_time' => 'stopTime',
        'unit_cost' => 'unitCost',
        'unit_price' => 'unitPrice',
        'updated_by' => 'updatedBy',
        'user_id' => 'userId',
        'worked_date' => 'workedDate',
        'worked_hours' => 'workedHours'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'charge_hours' => 'setChargeHours',
        'child_id' => 'setChildId',
        'cost_center' => 'setCostCenter',
        'created_by' => 'setCreatedBy',
        'created_time' => 'setCreatedTime',
        'customer' => 'setCustomer',
        'document_id' => 'setDocumentId',
        'document_type' => 'setDocumentType',
        'id' => 'setId',
        'invoice_basis_id' => 'setInvoiceBasisId',
        'invoice_text' => 'setInvoiceText',
        'non_invoiceable' => 'setNonInvoiceable',
        'note' => 'setNote',
        'project' => 'setProject',
        'registration_code' => 'setRegistrationCode',
        'service' => 'setService',
        'start_time' => 'setStartTime',
        'stop_time' => 'setStopTime',
        'unit_cost' => 'setUnitCost',
        'unit_price' => 'setUnitPrice',
        'updated_by' => 'setUpdatedBy',
        'user_id' => 'setUserId',
        'worked_date' => 'setWorkedDate',
        'worked_hours' => 'setWorkedHours'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'charge_hours' => 'getChargeHours',
        'child_id' => 'getChildId',
        'cost_center' => 'getCostCenter',
        'created_by' => 'getCreatedBy',
        'created_time' => 'getCreatedTime',
        'customer' => 'getCustomer',
        'document_id' => 'getDocumentId',
        'document_type' => 'getDocumentType',
        'id' => 'getId',
        'invoice_basis_id' => 'getInvoiceBasisId',
        'invoice_text' => 'getInvoiceText',
        'non_invoiceable' => 'getNonInvoiceable',
        'note' => 'getNote',
        'project' => 'getProject',
        'registration_code' => 'getRegistrationCode',
        'service' => 'getService',
        'start_time' => 'getStartTime',
        'stop_time' => 'getStopTime',
        'unit_cost' => 'getUnitCost',
        'unit_price' => 'getUnitPrice',
        'updated_by' => 'getUpdatedBy',
        'user_id' => 'getUserId',
        'worked_date' => 'getWorkedDate',
        'worked_hours' => 'getWorkedHours'
    ];

    /**
     * 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 DOCUMENT_TYPE_ORDER = 'order';
    public const DOCUMENT_TYPE_INVOICE = 'invoice';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getDocumentTypeAllowableValues()
    {
        return [
            self::DOCUMENT_TYPE_ORDER,
            self::DOCUMENT_TYPE_INVOICE,
        ];
    }

    /**
     * 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('charge_hours', $data ?? [], null);
        $this->setIfExists('child_id', $data ?? [], null);
        $this->setIfExists('cost_center', $data ?? [], null);
        $this->setIfExists('created_by', $data ?? [], null);
        $this->setIfExists('created_time', $data ?? [], null);
        $this->setIfExists('customer', $data ?? [], null);
        $this->setIfExists('document_id', $data ?? [], null);
        $this->setIfExists('document_type', $data ?? [], null);
        $this->setIfExists('id', $data ?? [], null);
        $this->setIfExists('invoice_basis_id', $data ?? [], null);
        $this->setIfExists('invoice_text', $data ?? [], null);
        $this->setIfExists('non_invoiceable', $data ?? [], null);
        $this->setIfExists('note', $data ?? [], null);
        $this->setIfExists('project', $data ?? [], null);
        $this->setIfExists('registration_code', $data ?? [], null);
        $this->setIfExists('service', $data ?? [], null);
        $this->setIfExists('start_time', $data ?? [], null);
        $this->setIfExists('stop_time', $data ?? [], null);
        $this->setIfExists('unit_cost', $data ?? [], null);
        $this->setIfExists('unit_price', $data ?? [], null);
        $this->setIfExists('updated_by', $data ?? [], null);
        $this->setIfExists('user_id', $data ?? [], null);
        $this->setIfExists('worked_date', $data ?? [], null);
        $this->setIfExists('worked_hours', $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 = [];

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

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

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

        if ($this->container['registration_code'] === null) {
            $invalidProperties[] = "'registration_code' can't be null";
        }
        if ($this->container['worked_date'] === null) {
            $invalidProperties[] = "'worked_date' can't be null";
        }
        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 charge_hours
     *
     * @return float|null
     */
    public function getChargeHours()
    {
        return $this->container['charge_hours'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

    /**
     * Sets cost_center
     *
     * @param \Fortnox\Model\TimeReportingTRCostCenter|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 created_by
     *
     * @return string|null
     */
    public function getCreatedBy()
    {
        return $this->container['created_by'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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

        return $this;
    }

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

    /**
     * Sets project
     *
     * @param \Fortnox\Model\TimeReportingTRProject|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 registration_code
     *
     * @return \Fortnox\Model\TimeReportingRegistrationCode
     */
    public function getRegistrationCode()
    {
        return $this->container['registration_code'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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


