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

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

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $openAPITypes = [
        'assignee_id' => 'string',
        'company_type' => 'string[]',
        'exclude_company_type' => 'string[]',
        'filter' => 'string',
        'filtered_user_id' => 'string',
        'filtered_user_id_has_access' => 'bool',
        'include_only_clients_without_tags' => 'bool',
        'include_states' => 'string[]',
        'show_only_favorites' => 'bool',
        'show_only_with_agoy_access' => 'bool',
        'tags' => 'string[]'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      * @phpstan-var array<string, string|null>
      * @psalm-var array<string, string|null>
      */
    protected static $openAPIFormats = [
        'assignee_id' => null,
        'company_type' => null,
        'exclude_company_type' => null,
        'filter' => null,
        'filtered_user_id' => null,
        'filtered_user_id_has_access' => null,
        'include_only_clients_without_tags' => null,
        'include_states' => null,
        'show_only_favorites' => null,
        'show_only_with_agoy_access' => null,
        'tags' => 'uuid'
    ];

    /**
      * Array of nullable properties. Used for (de)serialization
      *
      * @var boolean[]
      */
    protected static array $openAPINullables = [
        'assignee_id' => false,
        'company_type' => false,
        'exclude_company_type' => false,
        'filter' => false,
        'filtered_user_id' => false,
        'filtered_user_id_has_access' => false,
        'include_only_clients_without_tags' => false,
        'include_states' => false,
        'show_only_favorites' => false,
        'show_only_with_agoy_access' => false,
        'tags' => 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 = [
        'assignee_id' => 'assigneeId',
        'company_type' => 'companyType',
        'exclude_company_type' => 'excludeCompanyType',
        'filter' => 'filter',
        'filtered_user_id' => 'filteredUserId',
        'filtered_user_id_has_access' => 'filteredUserIdHasAccess',
        'include_only_clients_without_tags' => 'includeOnlyClientsWithoutTags',
        'include_states' => 'includeStates',
        'show_only_favorites' => 'showOnlyFavorites',
        'show_only_with_agoy_access' => 'showOnlyWithAgoyAccess',
        'tags' => 'tags'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'assignee_id' => 'setAssigneeId',
        'company_type' => 'setCompanyType',
        'exclude_company_type' => 'setExcludeCompanyType',
        'filter' => 'setFilter',
        'filtered_user_id' => 'setFilteredUserId',
        'filtered_user_id_has_access' => 'setFilteredUserIdHasAccess',
        'include_only_clients_without_tags' => 'setIncludeOnlyClientsWithoutTags',
        'include_states' => 'setIncludeStates',
        'show_only_favorites' => 'setShowOnlyFavorites',
        'show_only_with_agoy_access' => 'setShowOnlyWithAgoyAccess',
        'tags' => 'setTags'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'assignee_id' => 'getAssigneeId',
        'company_type' => 'getCompanyType',
        'exclude_company_type' => 'getExcludeCompanyType',
        'filter' => 'getFilter',
        'filtered_user_id' => 'getFilteredUserId',
        'filtered_user_id_has_access' => 'getFilteredUserIdHasAccess',
        'include_only_clients_without_tags' => 'getIncludeOnlyClientsWithoutTags',
        'include_states' => 'getIncludeStates',
        'show_only_favorites' => 'getShowOnlyFavorites',
        'show_only_with_agoy_access' => 'getShowOnlyWithAgoyAccess',
        'tags' => 'getTags'
    ];

    /**
     * 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 EXCLUDE_COMPANY_TYPE_ESTATE = 'ESTATE';
    public const EXCLUDE_COMPANY_TYPE_SOLE_TRADER = 'SOLE_TRADER';
    public const EXCLUDE_COMPANY_TYPE_NATURAL_PERSON = 'NATURAL_PERSON';
    public const EXCLUDE_COMPANY_TYPE_CORPORATION = 'CORPORATION';
    public const EXCLUDE_COMPANY_TYPE_NONPROFIT_ASSOCIATION = 'NONPROFIT_ASSOCIATION';
    public const EXCLUDE_COMPANY_TYPE_HOUSING_ASSOCIATION = 'HOUSING_ASSOCIATION';
    public const EXCLUDE_COMPANY_TYPE_TENANCY_COMPOUND = 'TENANCY_COMPOUND';
    public const EXCLUDE_COMPANY_TYPE_COOPERATIVE = 'COOPERATIVE';
    public const EXCLUDE_COMPANY_TYPE_ECONOMIC_ASSOCIATION = 'ECONOMIC_ASSOCIATION';
    public const EXCLUDE_COMPANY_TYPE_HOUSING_SOCIETY = 'HOUSING_SOCIETY';
    public const EXCLUDE_COMPANY_TYPE_RELIGIOUS_BODY = 'RELIGIOUS_BODY';
    public const EXCLUDE_COMPANY_TYPE_LIMITED_PARTNERSHIP = 'LIMITED_PARTNERSHIP';
    public const EXCLUDE_COMPANY_TYPE_PARTNERSHIP = 'PARTNERSHIP';
    public const EXCLUDE_COMPANY_TYPE_PRIVATE_INDIVIDUAL = 'PRIVATE_INDIVIDUAL';
    public const EXCLUDE_COMPANY_TYPE_UNKNOWN = 'UNKNOWN';
    public const INCLUDE_STATES_DISCONNECTED = 'DISCONNECTED';
    public const INCLUDE_STATES_ACTIVE = 'ACTIVE';
    public const INCLUDE_STATES_INACTIVE = 'INACTIVE';

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getExcludeCompanyTypeAllowableValues()
    {
        return [
            self::EXCLUDE_COMPANY_TYPE_ESTATE,
            self::EXCLUDE_COMPANY_TYPE_SOLE_TRADER,
            self::EXCLUDE_COMPANY_TYPE_NATURAL_PERSON,
            self::EXCLUDE_COMPANY_TYPE_CORPORATION,
            self::EXCLUDE_COMPANY_TYPE_NONPROFIT_ASSOCIATION,
            self::EXCLUDE_COMPANY_TYPE_HOUSING_ASSOCIATION,
            self::EXCLUDE_COMPANY_TYPE_TENANCY_COMPOUND,
            self::EXCLUDE_COMPANY_TYPE_COOPERATIVE,
            self::EXCLUDE_COMPANY_TYPE_ECONOMIC_ASSOCIATION,
            self::EXCLUDE_COMPANY_TYPE_HOUSING_SOCIETY,
            self::EXCLUDE_COMPANY_TYPE_RELIGIOUS_BODY,
            self::EXCLUDE_COMPANY_TYPE_LIMITED_PARTNERSHIP,
            self::EXCLUDE_COMPANY_TYPE_PARTNERSHIP,
            self::EXCLUDE_COMPANY_TYPE_PRIVATE_INDIVIDUAL,
            self::EXCLUDE_COMPANY_TYPE_UNKNOWN,
        ];
    }

    /**
     * Gets allowable values of the enum
     *
     * @return string[]
     */
    public function getIncludeStatesAllowableValues()
    {
        return [
            self::INCLUDE_STATES_DISCONNECTED,
            self::INCLUDE_STATES_ACTIVE,
            self::INCLUDE_STATES_INACTIVE,
        ];
    }

    /**
     * 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('assignee_id', $data ?? [], null);
        $this->setIfExists('company_type', $data ?? [], null);
        $this->setIfExists('exclude_company_type', $data ?? [], null);
        $this->setIfExists('filter', $data ?? [], null);
        $this->setIfExists('filtered_user_id', $data ?? [], null);
        $this->setIfExists('filtered_user_id_has_access', $data ?? [], null);
        $this->setIfExists('include_only_clients_without_tags', $data ?? [], null);
        $this->setIfExists('include_states', $data ?? [], null);
        $this->setIfExists('show_only_favorites', $data ?? [], null);
        $this->setIfExists('show_only_with_agoy_access', $data ?? [], null);
        $this->setIfExists('tags', $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 assignee_id
     *
     * @return string|null
     */
    public function getAssigneeId()
    {
        return $this->container['assignee_id'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

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


