<?php
/**
 * ProductModifierProductIn
 *
 * PHP version 7.4
 *
 * @category Class
 * @package  SmartVolution
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 */

/**
 * SV Register Web-services
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 4.15
 * Generated by: https://openapi-generator.tech
 * OpenAPI Generator version: 6.0.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 SmartVolution\Model;

use \ArrayAccess;
use \SmartVolution\ObjectSerializer;

/**
 * ProductModifierProductIn Class Doc Comment
 *
 * @category Class
 * @package  SmartVolution
 * @author   OpenAPI Generator team
 * @link     https://openapi-generator.tech
 * @implements \ArrayAccess<TKey, TValue>
 * @template TKey int|null
 * @template TValue mixed|null
 */
class ProductModifierProductIn implements ModelInterface, ArrayAccess, \JsonSerializable
{
    public const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'childProductId' => 'int',
        'appliedByDefault' => 'bool',
        'defaultQty' => 'double',
        'editable' => 'bool',
        'minQty' => 'double',
        'maxQty' => 'double',
        'displayInJournal' => 'bool',
        'usePricebook' => 'bool',
        'followTransactionPricebook' => 'bool',
        'priceBookId' => 'int',
        'defaultQuantityFreeOfCharge' => 'bool',
        'sortorder' => '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 = [
        'childProductId' => 'int64',
        'appliedByDefault' => null,
        'defaultQty' => 'double',
        'editable' => null,
        'minQty' => 'double',
        'maxQty' => 'double',
        'displayInJournal' => null,
        'usePricebook' => null,
        'followTransactionPricebook' => null,
        'priceBookId' => 'int64',
        'defaultQuantityFreeOfCharge' => null,
        'sortorder' => 'int64'
    ];

    /**
     * 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 attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'childProductId' => 'childProductId',
        'appliedByDefault' => 'appliedByDefault',
        'defaultQty' => 'defaultQty',
        'editable' => 'editable',
        'minQty' => 'minQty',
        'maxQty' => 'maxQty',
        'displayInJournal' => 'displayInJournal',
        'usePricebook' => 'usePricebook',
        'followTransactionPricebook' => 'followTransactionPricebook',
        'priceBookId' => 'priceBookId',
        'defaultQuantityFreeOfCharge' => 'defaultQuantityFreeOfCharge',
        'sortorder' => 'sortorder'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'childProductId' => 'setChildProductId',
        'appliedByDefault' => 'setAppliedByDefault',
        'defaultQty' => 'setDefaultQty',
        'editable' => 'setEditable',
        'minQty' => 'setMinQty',
        'maxQty' => 'setMaxQty',
        'displayInJournal' => 'setDisplayInJournal',
        'usePricebook' => 'setUsePricebook',
        'followTransactionPricebook' => 'setFollowTransactionPricebook',
        'priceBookId' => 'setPriceBookId',
        'defaultQuantityFreeOfCharge' => 'setDefaultQuantityFreeOfCharge',
        'sortorder' => 'setSortorder'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'childProductId' => 'getChildProductId',
        'appliedByDefault' => 'getAppliedByDefault',
        'defaultQty' => 'getDefaultQty',
        'editable' => 'getEditable',
        'minQty' => 'getMinQty',
        'maxQty' => 'getMaxQty',
        'displayInJournal' => 'getDisplayInJournal',
        'usePricebook' => 'getUsePricebook',
        'followTransactionPricebook' => 'getFollowTransactionPricebook',
        'priceBookId' => 'getPriceBookId',
        'defaultQuantityFreeOfCharge' => 'getDefaultQuantityFreeOfCharge',
        'sortorder' => 'getSortorder'
    ];

    /**
     * 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[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['childProductId'] = $data['childProductId'] ?? null;
        $this->container['appliedByDefault'] = $data['appliedByDefault'] ?? null;
        $this->container['defaultQty'] = $data['defaultQty'] ?? null;
        $this->container['editable'] = $data['editable'] ?? null;
        $this->container['minQty'] = $data['minQty'] ?? null;
        $this->container['maxQty'] = $data['maxQty'] ?? null;
        $this->container['displayInJournal'] = $data['displayInJournal'] ?? null;
        $this->container['usePricebook'] = $data['usePricebook'] ?? null;
        $this->container['followTransactionPricebook'] = $data['followTransactionPricebook'] ?? null;
        $this->container['priceBookId'] = $data['priceBookId'] ?? null;
        $this->container['defaultQuantityFreeOfCharge'] = $data['defaultQuantityFreeOfCharge'] ?? null;
        $this->container['sortorder'] = $data['sortorder'] ?? null;
    }

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

    /**
     * Sets childProductId
     *
     * @param int|null $childProductId Child Product Id
     *
     * @return self
     */
    public function setChildProductId($childProductId)
    {
        $this->container['childProductId'] = $childProductId;

        return $this;
    }

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

    /**
     * Sets appliedByDefault
     *
     * @param bool|null $appliedByDefault Applied By Default
     *
     * @return self
     */
    public function setAppliedByDefault($appliedByDefault)
    {
        $this->container['appliedByDefault'] = $appliedByDefault;

        return $this;
    }

    /**
     * Gets defaultQty
     *
     * @return double|null
     */
    public function getDefaultQty()
    {
        return $this->container['defaultQty'];
    }

    /**
     * Sets defaultQty
     *
     * @param double|null $defaultQty Default quantity
     *
     * @return self
     */
    public function setDefaultQty($defaultQty)
    {
        $this->container['defaultQty'] = $defaultQty;

        return $this;
    }

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

    /**
     * Sets editable
     *
     * @param bool|null $editable Editable
     *
     * @return self
     */
    public function setEditable($editable)
    {
        $this->container['editable'] = $editable;

        return $this;
    }

    /**
     * Gets minQty
     *
     * @return double|null
     */
    public function getMinQty()
    {
        return $this->container['minQty'];
    }

    /**
     * Sets minQty
     *
     * @param double|null $minQty Min quantity
     *
     * @return self
     */
    public function setMinQty($minQty)
    {
        $this->container['minQty'] = $minQty;

        return $this;
    }

    /**
     * Gets maxQty
     *
     * @return double|null
     */
    public function getMaxQty()
    {
        return $this->container['maxQty'];
    }

    /**
     * Sets maxQty
     *
     * @param double|null $maxQty Max quantity
     *
     * @return self
     */
    public function setMaxQty($maxQty)
    {
        $this->container['maxQty'] = $maxQty;

        return $this;
    }

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

    /**
     * Sets displayInJournal
     *
     * @param bool|null $displayInJournal Display In Journal
     *
     * @return self
     */
    public function setDisplayInJournal($displayInJournal)
    {
        $this->container['displayInJournal'] = $displayInJournal;

        return $this;
    }

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

    /**
     * Sets usePricebook
     *
     * @param bool|null $usePricebook Use Price Book
     *
     * @return self
     */
    public function setUsePricebook($usePricebook)
    {
        $this->container['usePricebook'] = $usePricebook;

        return $this;
    }

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

    /**
     * Sets followTransactionPricebook
     *
     * @param bool|null $followTransactionPricebook Follow Transaction Price Book
     *
     * @return self
     */
    public function setFollowTransactionPricebook($followTransactionPricebook)
    {
        $this->container['followTransactionPricebook'] = $followTransactionPricebook;

        return $this;
    }

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

    /**
     * Sets priceBookId
     *
     * @param int|null $priceBookId Price Book Id
     *
     * @return self
     */
    public function setPriceBookId($priceBookId)
    {
        $this->container['priceBookId'] = $priceBookId;

        return $this;
    }

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

    /**
     * Sets defaultQuantityFreeOfCharge
     *
     * @param bool|null $defaultQuantityFreeOfCharge Default quantity free of charge
     *
     * @return self
     */
    public function setDefaultQuantityFreeOfCharge($defaultQuantityFreeOfCharge)
    {
        $this->container['defaultQuantityFreeOfCharge'] = $defaultQuantityFreeOfCharge;

        return $this;
    }

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

    /**
     * Sets sortorder
     *
     * @param int|null $sortorder Sort Order
     *
     * @return self
     */
    public function setSortorder($sortorder)
    {
        $this->container['sortorder'] = $sortorder;

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


