<?php

namespace HelpGent\App\DTO;

defined( "ABSPATH" ) || exit;

use HelpGent\WpMVC\DTO\DTO;
use HelpGent\App\EnumeratedList\UserType;
use DateTime;
use Exception;

class UserDTO extends DTO {
    private int $id;

    private string $user_type = UserType::USER;

    private ?string $email;

    private ?string $name;

    private ?string $number;

    private ?string $company;

    private ?string $token;

    private int $acceptance = 0;

    private ?int $registered_id;

    private ?int $avatar_id;

    private ?DateTime $token_expires_at;

    private ?string $about = null;

    private ?string $timezone = null;

    private ?string $created_at;

    private bool $administrator;

    private bool $agent;

    /**
     * Get the value of id
     *
     * @return int
     */
    public function get_id(): int {
        return $this->id;
    }

    /**
     * Set the value of id
     *
     * @param int $id
     * @return self
     */
    public function set_id( int $id ): self {
        $this->id = $id;

        return $this;
    }

    /**
     * Get the value of user_type
     *
     * @return string
     */
    public function get_user_type(): string {
        return $this->user_type;
    }

    /**
     * Set the value of user_type
     *
     * @param string $user_type
     * @return self
     * @throws Exception
     */
    public function set_user_type( string $user_type ): self {
        if ( ! in_array( $user_type, UserType::get_keys() ) ) {
            throw new Exception( esc_html__( 'Invalid user type', 'helpgent' ), 422 );
        }

        $this->user_type = $user_type;

        return $this;
    }

    /**
     * Get the value of email
     *
     * @return ?string
     */
    public function get_email(): ?string {
        return $this->email;
    }

    /**
     * Set the value of email
     *
     * @param ?string $email
     * @return self
     */
    public function set_email( ?string $email ): self {
        $this->email = $email;

        return $this;
    }

    /**
     * Get the value of name
     *
     * @return ?string
     */
    public function get_name(): ?string {
        return $this->name;
    }

    /**
     * Set the value of name
     *
     * @param ?string $name
     * @return self
     */
    public function set_name( ?string $name ): self {
        $this->name = $name;

        return $this;
    }

    /**
     * Get the value of number
     *
     * @return ?string
     */
    public function get_number(): ?string {
        return $this->number;
    }

    /**
     * Set the value of number
     *
     * @param ?string $number
     * @return self
     */
    public function set_number( ?string $number ): self {
        $this->number = $number;

        return $this;
    }

    /**
     * Get the value of company
     *
     * @return ?string
     */
    public function get_company(): ?string {
        return $this->company;
    }

    /**
     * Set the value of company
     *
     * @param ?string $company
     * @return self
     */
    public function set_company( ?string $company ): self {
        $this->company = $company;

        return $this;
    }

    /**
     * Get the value of token
     *
     * @return ?string
     */
    public function get_token(): ?string {
        return $this->token;
    }

    /**
     * Set the value of token
     *
     * @param ?string $token
     * @return self
     */
    public function set_token( ?string $token ): self {
        $this->token = $token;

        return $this;
    }

    /**
     * Get the value of acceptance
     *
     * @return int
     */
    public function get_acceptance(): int {
        return $this->acceptance;
    }

    /**
     * Set the value of acceptance
     *
     * @param int $acceptance
     * @return self
     */
    public function set_acceptance( int $acceptance ): self {
        $this->acceptance = $acceptance;

        return $this;
    }

    /**
     * Get the value of registered_id
     *
     * @return ?int
     */
    public function get_registered_id(): ?int {
        return $this->registered_id;
    }

    /**
     * Set the value of registered_id
     *
     * @param ?int $registered_id
     * @return self
     */
    public function set_registered_id( ?int $registered_id ): self {
        $this->registered_id = $registered_id;

        return $this;
    }

    /**
     * Get the value of avatar_id
     *
     * @return ?int
     */
    public function get_avatar_id(): ?int {
        return $this->avatar_id;
    }

    /**
     * Set the value of avatar_id
     *
     * @param ?int $avatar_id
     * @return self
     */
    public function set_avatar_id( ?int $avatar_id ): self {
        $this->avatar_id = $avatar_id;

        return $this;
    }

    /**
     * Get the value of token_expires_at
     *
     * @return ?DateTime
     */
    public function get_token_expires_at(): ?DateTime {
        return $this->token_expires_at;
    }

    /**
     * Set the value of token_expires_at
     *
     * @param ?DateTime $token_expires_at 
     * @return self
     */
    public function set_token_expires_at( ?DateTime $token_expires_at ): self {
        $this->token_expires_at = $token_expires_at;

        return $this;
    }

    /**
     * Get the value of about
     *
     * @return ?string
     */
    public function get_about(): ?string {
        return $this->about;
    }

    /**
     * Set the value of about
     *
     * @param ?string $about
     * @return self
     */
    public function set_about( ?string $about ): self {
        $this->about = $about;

        return $this;
    }

    /**
     * Get the value of timezone
     *
     * @return ?string
     */
    public function get_timezone(): ?string {
        return $this->timezone;
    }

    /**
     * Set the value of timezone
     *
     * @param ?string $timezone
     * @return self
     */
    public function set_timezone( ?string $timezone ): self {
        $this->timezone = $timezone;

        return $this;
    }

    /**
     * Get the value of created_at
     *
     * @return ?string
     */
    public function get_created_at(): ?string {
        return $this->created_at;
    }

    /**
     * Set the value of created_at
     *
     * @param ?string $created_at
     * @return self
     */
    public function set_created_at( ?string $created_at ): self {
        $this->created_at = $created_at;

        return $this;
    }

    /**
     * Get the value of administrator
     *
     * @return bool
     */
    public function is_administrator(): bool {
        return $this->administrator;
    }

    /**
     * Set the value of administrator
     *
     * @param bool $administrator
     * @return self
     */
    public function set_administrator( bool $administrator ): self {
        $this->administrator = $administrator;

        return $this;
    }

    /**
     * Get the value of agent
     *
     * @return bool
     */
    public function is_agent(): bool {
        return $this->agent;
    }

    /**
     * Set the value of agent
     *
     * @param bool $agent
     * @return self
     */
    public function set_agent( bool $agent ): self {
        $this->agent = $agent;

        return $this;
    }
}