Covivo/mobicoop

View on GitHub
api/src/CarpoolStandard/Entity/User.php

Summary

Maintainability
A
2 hrs
Test Coverage
<?php

/**
 * Copyright (c) 2023, MOBICOOP. All rights reserved.
 * This project is dual licensed under AGPL and proprietary licence.
 ***************************
 *    This program is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU Affero General Public License as
 *    published by the Free Software Foundation, either version 3 of the
 *    License, or (at your option) any later version.
 *
 *    This program is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU Affero General Public License for more details.
 *
 *    You should have received a copy of the GNU Affero General Public License
 *    along with this program.  If not, see <gnu.org/licenses>.
 ***************************
 *    Licence MOBICOOP described in the file
 *    LICENSE
 */

namespace App\CarpoolStandard\Entity;

use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;

/**
 * A User.
 *
 * @author Remi Wortemann <remi.wortemann@mobicoop.org>
 */
class User
{
    public const DEFAULT_ID = 999999999999;

    /**
     * @var null|int The id of this user
     *
     * @Groups({"read", "write"})
     */
    private $id;

    /**
     * @var null|string The id of this user
     *
     * @Groups({"read", "write"})
     */
    private $externalId;

    /**
     * @var string the operator identifier
     *
     * @Assert\NotBlank
     *
     * @Groups({"read", "write"})
     */
    private $operator;

    /**
     * @var string User's alias
     *
     * @Assert\NotBlank
     *
     * @Groups({"read", "write"})
     */
    private $alias;

    /**
     * @var null|string user's first name
     *
     * @Groups({"read", "write"})
     */
    private $firstName;

    /**
     * @var null|string user's last name
     *
     * @Groups({"read", "write"})
     */
    private $lastName;

    /**
     * @var null|int user's grade from 1 to 5
     *
     * @Groups({"read", "write"})
     */
    private $grade;

    /**
     * @var null|string user's profile picture absolute URL
     *
     * @Groups({"read", "write"})
     */
    private $picture;

    /**
     * @var null|string User's gender. [ F, M, O ] 'O' stands for 'Other'.
     *
     * @Groups({"read", "write"})
     */
    private $gender;

    /**
     * @var null|bool
     *
     * @Groups({"read", "write"})
     */
    private $verifiedIdentity;

    public function __construct($id = null)
    {
        $this->id = self::DEFAULT_ID;
        if ($id) {
            $this->id = $id;
        }
    }

    public function getId(): int
    {
        return $this->id;
    }

    public function setId(int $id): self
    {
        $this->id = $id;

        return $this;
    }

    public function getExternalId(): ?string
    {
        return $this->externalId;
    }

    public function setExternalId(?string $externalId): self
    {
        $this->externalId = $externalId;

        return $this;
    }

    public function getOperator(): string
    {
        return $this->operator;
    }

    public function setOperator(string $operator): self
    {
        $this->operator = $operator;

        return $this;
    }

    public function getAlias(): string
    {
        return $this->alias;
    }

    public function setAlias(string $alias): self
    {
        $this->alias = $alias;

        return $this;
    }

    public function getFirstName(): ?string
    {
        return $this->firstName;
    }

    public function setFirstName(?string $firstName): self
    {
        $this->firstName = $firstName;

        return $this;
    }

    public function getLastName(): ?string
    {
        return $this->lastName;
    }

    public function setLastName(?string $lastName): self
    {
        $this->lastName = $lastName;

        return $this;
    }

    public function getGrade(): ?int
    {
        return $this->grade;
    }

    public function setGrade(?int $grade): self
    {
        $this->grade = $grade;

        return $this;
    }

    public function getPicture(): ?string
    {
        return $this->picture;
    }

    public function setPicture(?string $picture): self
    {
        $this->picture = $picture;

        return $this;
    }

    public function getGender(): ?string
    {
        return $this->gender;
    }

    public function setGender(?string $gender): self
    {
        $this->gender = $gender;

        return $this;
    }

    public function getVerifiedIdentity(): ?bool
    {
        return $this->verifiedIdentity;
    }

    public function setVerifiedIdentity(?bool $verifiedIdentity): self
    {
        $this->verifiedIdentity = $verifiedIdentity;

        return $this;
    }
}