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

/**
 * ChurchTools REST API
 *
 * The ChurchTools REST API is the best entry point for developers to access ChurchTools. <br><br> **Authentication:** You need to be authorized to use some endpoints. Those endpoints are marked by a gray lock symbol. If you view the documentation, while you are logged into ChurchTools, all requests are already authorized. If you want to authorized a request, you need to provide a `Login Token` as `Authorization` header in the format `Authorization: Login<token>` or send a valid cookie. You can use the green \"Authorize\" dialog to enter those details and see how a request would look like in detail. <br><br> **Missing Endpoints:** Not all features are yet available by our new REST API. This documentation will grow in the future. We are working hard to add new endpoints with every ChurchTools version. The documentation will always show only those endpoints you can use with your ChurchTools installation.
 *
 * The version of the OpenAPI document: 0.1.0
 * Generated by: https://openapi-generator.tech
 * Generator version: 7.21.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 StevenBuehner\ChurchTools\Model;

use \ArrayAccess;
use \StevenBuehner\ChurchTools\ObjectSerializer;

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

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

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @var string[]
     */
    protected static $openAPITypes = [
        'allow_child_registration' => 'bool',
        'allow_other_registration' => 'bool',
        'allow_sameemail_registration' => 'bool',
        'allow_spouse_registration' => 'bool',
        'hide_contact_leader' => 'bool',
        'hide_login' => 'bool',
        'sign_up_notification_sent' => 'mixed'
    ];

    /**
     * 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 = [
        'allow_child_registration' => null,
        'allow_other_registration' => null,
        'allow_sameemail_registration' => null,
        'allow_spouse_registration' => null,
        'hide_contact_leader' => null,
        'hide_login' => null,
        'sign_up_notification_sent' => null
    ];

    /**
     * Array of nullable properties. Used for (de)serialization
     *
     * @var boolean[]
     */
    protected static array $openAPINullables = [
        'allow_child_registration' => false,
        'allow_other_registration' => false,
        'allow_sameemail_registration' => false,
        'allow_spouse_registration' => false,
        'hide_contact_leader' => false,
        'hide_login' => false,
        'sign_up_notification_sent' => 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 = [
        'allow_child_registration' => 'allowChildRegistration',
        'allow_other_registration' => 'allowOtherRegistration',
        'allow_sameemail_registration' => 'allowSameemailRegistration',
        'allow_spouse_registration' => 'allowSpouseRegistration',
        'hide_contact_leader' => 'hideContactLeader',
        'hide_login' => 'hideLogin',
        'sign_up_notification_sent' => 'signUpNotificationSent'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'allow_child_registration' => 'setAllowChildRegistration',
        'allow_other_registration' => 'setAllowOtherRegistration',
        'allow_sameemail_registration' => 'setAllowSameemailRegistration',
        'allow_spouse_registration' => 'setAllowSpouseRegistration',
        'hide_contact_leader' => 'setHideContactLeader',
        'hide_login' => 'setHideLogin',
        'sign_up_notification_sent' => 'setSignUpNotificationSent'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'allow_child_registration' => 'getAllowChildRegistration',
        'allow_other_registration' => 'getAllowOtherRegistration',
        'allow_sameemail_registration' => 'getAllowSameemailRegistration',
        'allow_spouse_registration' => 'getAllowSpouseRegistration',
        'hide_contact_leader' => 'getHideContactLeader',
        'hide_login' => 'getHideLogin',
        'sign_up_notification_sent' => 'getSignUpNotificationSent'
    ];

    /**
     * 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('allow_child_registration', $data ?? [], null);
        $this->setIfExists('allow_other_registration', $data ?? [], null);
        $this->setIfExists('allow_sameemail_registration', $data ?? [], null);
        $this->setIfExists('allow_spouse_registration', $data ?? [], null);
        $this->setIfExists('hide_contact_leader', $data ?? [], null);
        $this->setIfExists('hide_login', $data ?? [], null);
        $this->setIfExists('sign_up_notification_sent', $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 allow_child_registration
     *
     * @return bool|null
     */
    public function getAllowChildRegistration()
    {
        return $this->container['allow_child_registration'];
    }

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

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

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

        return $this;
    }

    /**
     * Gets sign_up_notification_sent
     *
     * @return mixed|null
     */
    public function getSignUpNotificationSent()
    {
        return $this->container['sign_up_notification_sent'];
    }

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

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


