<?php
namespace WorkbloomERP\Module\v0\Usuario\Models;

use DateTimeImmutable;

class UsuarioModel {
    public function __construct(
        private ?int $id = null,
        private ?string $uuid = null,
        private ?bool $is_active = null,
        private ?bool $is_root = null,
        private ?string $nome_completo = null,
        private ?string $nome_usuario = null,
        private ?string $email = null,
        private ?string $senha_hash = null,
        private ?DateTimeImmutable $created_at = null,
        private ?DateTimeImmutable $updated_at = null,
        private ?DateTimeImmutable $deleted_at = null,
    ) {}

    public function toArray(): array {
        return [
            'id' => $this->getId(),
            'uuid' => $this->getUuid(),
            'is_active' => $this->getIsActive(),
            'is_root' => $this->getIsRoot(),
            'nome_completo' => $this->getNomeCompleto(),
            'nome_usuario' => $this->getNomeUsuario(),
            'email' => $this->getEmail(),
            'senha_hash' => $this->getSenhaHash(),
            'created_at' => $this->getCreatedAt() ? $this->getCreatedAt()->format('Y-m-d H:i:s') : null,
            'updated_at' => $this->getUpdatedAt() ? $this->getUpdatedAt()->format('Y-m-d H:i:s') : null,
            'deleted_at' => $this->getDeletedAt() ? $this->getDeletedAt()->format('Y-m-d H:i:s') : null,
        ];
    }

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

    public function setUuid(?string $uuid): void {
        $this->uuid = $uuid;
    }
    public function getUuid(): ?string {
        return $this->uuid;
    }

    public function setIsActive(?bool $is_active): void {
        $this->is_active = $is_active;
    }
    public function getIsActive(): ?bool {
        return $this->is_active;
    }

    public function setIsRoot(?bool $is_root): void {
        $this->is_root = $is_root;
    }
    public function getIsRoot(): ?bool {
        return $this->is_root;
    }

    public function setNomeCompleto(?string $nome_completo): void {
        $this->nome_completo = $nome_completo;
    }
    public function getNomeCompleto(): ?string {
        return $this->nome_completo;
    }

    public function setNomeUsuario(?string $nome_usuario): void {
        $this->nome_usuario = $nome_usuario;
    }
    public function getNomeUsuario(): ?string {
        return $this->nome_usuario;
    }

    public function setEmail(?string $email): void {
        $this->email = $email;
    }
    public function getEmail(): ?string {
        return $this->email;
    }

    public function setSenhaHash(?string $senha_hash): void {
        $this->senha_hash = $senha_hash;
    }
    public function getSenhaHash(): ?string {
        return $this->senha_hash;
    }

    public function setCreatedAt(?DateTimeImmutable $created_at): void {
        $this->created_at = $created_at;
    }
    public function getCreatedAt(): ?DateTimeImmutable {
        return $this->created_at;
    }

    public function setUpdatedAt(?DateTimeImmutable $updated_at): void {
        $this->updated_at = $updated_at;
    }
    public function getUpdatedAt(): ?DateTimeImmutable {
        return $this->updated_at;
    }

    public function setDeletedAt(?DateTimeImmutable $deleted_at): void {
        $this->deleted_at = $deleted_at;
    }
    public function getDeletedAt(): ?DateTimeImmutable {
        return $this->deleted_at;
    }
}