<?php
/**
 * PersonType
 *
 * PHP version 5
 *
 * @category Class
 * @package  Fifa\ConnectId\Sdk\Api
 * @author   Swaagger Codegen team
 * @link     https://github.com/swagger-api/swagger-codegen
 */

/**
 * FIFA Connect ID - ID Directory V6
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: v6
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 */

/**
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen
 * Do not edit the class manually.
 */

namespace Fifa\ConnectId\Sdk\Api\Model;

use \ArrayAccess;

/**
 * PersonType Class Doc Comment
 *
 * @category    Class
 * @package     Fifa\ConnectId\Sdk\Api
 * @author      Swagger Codegen team
 * @link        https://github.com/swagger-api/swagger-codegen
 */
class PersonType implements ArrayAccess
{
    const DISCRIMINATOR = null;

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

    /**
      * Array of property to type mappings. Used for (de)serialization
      * @var string[]
      */
    protected static $swaggerTypes = [
        'date_of_birth' => '\DateTime',
        'gender' => 'string',
        'player_registrations' => '\Fifa\ConnectId\Sdk\Api\Model\PlayerRegistrationType[]',
        'match_official_registrations' => '\Fifa\ConnectId\Sdk\Api\Model\MatchOfficialRegistrationType[]',
        'team_official_registrations' => '\Fifa\ConnectId\Sdk\Api\Model\TeamOfficialRegistrationType[]',
        'organisation_official_registrations' => '\Fifa\ConnectId\Sdk\Api\Model\OrganisationOfficialRegistrationType[]'
    ];

    public static function swaggerTypes()
    {
        return self::$swaggerTypes;
    }

    /**
     * Array of attributes where the key is the local name, and the value is the original name
     * @var string[]
     */
    protected static $attributeMap = [
        'date_of_birth' => 'dateOfBirth',
        'gender' => 'gender',
        'player_registrations' => 'playerRegistrations',
        'match_official_registrations' => 'matchOfficialRegistrations',
        'team_official_registrations' => 'teamOfficialRegistrations',
        'organisation_official_registrations' => 'organisationOfficialRegistrations'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     * @var string[]
     */
    protected static $setters = [
        'date_of_birth' => 'setDateOfBirth',
        'gender' => 'setGender',
        'player_registrations' => 'setPlayerRegistrations',
        'match_official_registrations' => 'setMatchOfficialRegistrations',
        'team_official_registrations' => 'setTeamOfficialRegistrations',
        'organisation_official_registrations' => 'setOrganisationOfficialRegistrations'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     * @var string[]
     */
    protected static $getters = [
        'date_of_birth' => 'getDateOfBirth',
        'gender' => 'getGender',
        'player_registrations' => 'getPlayerRegistrations',
        'match_official_registrations' => 'getMatchOfficialRegistrations',
        'team_official_registrations' => 'getTeamOfficialRegistrations',
        'organisation_official_registrations' => 'getOrganisationOfficialRegistrations'
    ];

    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    public static function setters()
    {
        return self::$setters;
    }

    public static function getters()
    {
        return self::$getters;
    }

    const GENDER_MALE = 'male';
    const GENDER_FEMALE = 'female';

    /**
     * Gets allowable values of the enum
     * @return string[]
     */
    public function getGenderAllowableValues()
    {
        return [
            self::GENDER_MALE,
            self::GENDER_FEMALE,
        ];
    }

    /**
     * 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['date_of_birth'] = isset($data['date_of_birth']) ? $data['date_of_birth'] : null;
        $this->container['gender'] = isset($data['gender']) ? $data['gender'] : null;
        $this->container['player_registrations'] = isset($data['player_registrations']) ? $data['player_registrations'] : null;
        $this->container['match_official_registrations'] = isset($data['match_official_registrations']) ? $data['match_official_registrations'] : null;
        $this->container['team_official_registrations'] = isset($data['team_official_registrations']) ? $data['team_official_registrations'] : null;
        $this->container['organisation_official_registrations'] = isset($data['organisation_official_registrations']) ? $data['organisation_official_registrations'] : null;
    }

    /**
     * show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalid_properties = [];

        if ($this->container['date_of_birth'] === null) {
            $invalid_properties[] = "'date_of_birth' can't be null";
        }
        $allowed_values = ["male", "female"];
        if (!in_array($this->container['gender'], $allowed_values)) {
            $invalid_properties[] = "invalid value for 'gender', must be one of 'male', 'female'.";
        }

        return $invalid_properties;
    }

    /**
     * validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {

        if ($this->container['date_of_birth'] === null) {
            return false;
        }
        $allowed_values = ["male", "female"];
        if (!in_array($this->container['gender'], $allowed_values)) {
            return false;
        }
        return true;
    }

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

    /**
     * Sets date_of_birth
     * @param \DateTime $date_of_birth The date of birth of a person
     * @return $this
     */
    public function setDateOfBirth($date_of_birth)
    {
        $this->container['date_of_birth'] = $date_of_birth;

        return $this;
    }

    /**
     * Gets gender
     * @return string
     */
    public function getGender()
    {
        return $this->container['gender'];
    }

    /**
     * Sets gender
     * @param string $gender The sex of the person
     * @return $this
     */
    public function setGender($gender)
    {
        $allowed_values = array('male', 'female');
        if (!is_null($gender) && (!in_array($gender, $allowed_values))) {
            throw new \InvalidArgumentException("Invalid value for 'gender', must be one of 'male', 'female'");
        }
        $this->container['gender'] = $gender;

        return $this;
    }

    /**
     * Gets player_registrations
     * @return \Fifa\ConnectId\Sdk\Api\Model\PlayerRegistrationType[]
     */
    public function getPlayerRegistrations()
    {
        return $this->container['player_registrations'];
    }

    /**
     * Sets player_registrations
     * @param \Fifa\ConnectId\Sdk\Api\Model\PlayerRegistrationType[] $player_registrations A collection of player's registrations with attributes
     * @return $this
     */
    public function setPlayerRegistrations($player_registrations)
    {
        $this->container['player_registrations'] = $player_registrations;

        return $this;
    }

    /**
     * Gets match_official_registrations
     * @return \Fifa\ConnectId\Sdk\Api\Model\MatchOfficialRegistrationType[]
     */
    public function getMatchOfficialRegistrations()
    {
        return $this->container['match_official_registrations'];
    }

    /**
     * Sets match_official_registrations
     * @param \Fifa\ConnectId\Sdk\Api\Model\MatchOfficialRegistrationType[] $match_official_registrations A collection of match official registrations with attributes
     * @return $this
     */
    public function setMatchOfficialRegistrations($match_official_registrations)
    {
        $this->container['match_official_registrations'] = $match_official_registrations;

        return $this;
    }

    /**
     * Gets team_official_registrations
     * @return \Fifa\ConnectId\Sdk\Api\Model\TeamOfficialRegistrationType[]
     */
    public function getTeamOfficialRegistrations()
    {
        return $this->container['team_official_registrations'];
    }

    /**
     * Sets team_official_registrations
     * @param \Fifa\ConnectId\Sdk\Api\Model\TeamOfficialRegistrationType[] $team_official_registrations A collection of team official registrations with attributes
     * @return $this
     */
    public function setTeamOfficialRegistrations($team_official_registrations)
    {
        $this->container['team_official_registrations'] = $team_official_registrations;

        return $this;
    }

    /**
     * Gets organisation_official_registrations
     * @return \Fifa\ConnectId\Sdk\Api\Model\OrganisationOfficialRegistrationType[]
     */
    public function getOrganisationOfficialRegistrations()
    {
        return $this->container['organisation_official_registrations'];
    }

    /**
     * Sets organisation_official_registrations
     * @param \Fifa\ConnectId\Sdk\Api\Model\OrganisationOfficialRegistrationType[] $organisation_official_registrations A collection of organisation official registrations with attributes
     * @return $this
     */
    public function setOrganisationOfficialRegistrations($organisation_official_registrations)
    {
        $this->container['organisation_official_registrations'] = $organisation_official_registrations;

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

    /**
     * Gets offset.
     * @param  integer $offset Offset
     * @return mixed
     */
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     * @param  integer $offset Offset
     * @param  mixed   $value  Value to be set
     * @return void
     */
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     * @param  integer $offset Offset
     * @return void
     */
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(\Fifa\ConnectId\Sdk\Api\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT);
        }

        return json_encode(\Fifa\ConnectId\Sdk\Api\ObjectSerializer::sanitizeForSerialization($this));
    }
}


