<?php
    namespace Zampet\Module\Tutor\v0\DTO;

    class PetDTO {
        private ?int $id = null;
        private ?string $uuid = null;
        private ?string $nome = null;
        private ?int $especie_id = null;
        private ?int $raca_id = null;
        private ?string $caminho_foto = null;
        private ?string $registro_geral_animal = null;
        private ?string $photo_path = null;
        private ?string $data_nascimento = null;
        private ?string $data_obito = null;
        private ?string $sexo = null;
        private ?string $created_at = null;
        private ?string $updated_at = null;
        private ?string $deleted_at = null;

        /**
         * Construtor do DTO.
         *
         * Permite inicializar os atributos do objeto a partir de um array associativo.
         *
         * @param array<string, mixed> $data Array associativo opcional para popular os atributos.
         */
        public function __construct(array $data = []) {
            if (!empty($data)) {
                $this->fromArray($data);
            }
        }

        /**
         * Popula o DTO a partir de um array.
         *
         * @param array<string, mixed> $data
         * @return void
         */
        public function fromArray(array $data): void {
            $this->id = $data['id'] ?? $this->id;
            $this->uuid = $data['uuid'] ?? $this->uuid;
            $this->nome = $data['nome'] ?? $this->nome;
            $this->especie_id = $data['especie_id'] ?? $this->especie_id;
            $this->raca_id = $data['raca_id'] ?? $this->raca_id;
            $this->caminho_foto = $data['caminho_foto'] ?? $this->caminho_foto;
            $this->registro_geral_animal = $data['registro_geral_animal'] ?? $this->registro_geral_animal;
            $this->photo_path = $data['photo_path'] ?? $this->photo_path;
            $this->data_nascimento = $data['data_nascimento'] ?? $this->data_nascimento;
            $this->data_obito = $data['data_obito'] ?? $this->data_obito;
            $this->sexo = $data['sexo'] ?? $this->sexo;
            $this->created_at = $data['created_at'] ?? $this->created_at;
            $this->updated_at = $data['updated_at'] ?? $this->updated_at;
            $this->deleted_at = $data['deleted_at'] ?? $this->deleted_at;
        }

        /**
         * Converte o DTO para um array associativo.
         *
         * @return array<string, mixed>
         */
        public function toArray(): array {
            return [
                'id' => $this->id,
                'uuid' => $this->uuid,
                'nome' => $this->nome,
                'especie_id' => $this->especie_id,
                'raca_id' => $this->raca_id,
                'caminho_foto' => $this->caminho_foto,
                'registro_geral_animal' => $this->registro_geral_animal,
                'photo_path' => $this->photo_path,
                'data_nascimento' => $this->data_nascimento,
                'data_obito' => $this->data_obito,
                'sexo' => $this->sexo,
                'created_at' => $this->created_at,
                'updated_at' => $this->updated_at,
                'deleted_at' => $this->deleted_at,
            ];
        }

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

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

        public function getNome(): ?string {
            return $this->nome;
        }
        public function setNome(?string $nome): void {
            $this->nome = $nome;
        }

        public function getEspecieId(): ?int {
            return $this->especie_id;
        }
        public function setEspecieId(?int $especie_id): void {
            $this->especie_id = $especie_id;
        }

        public function getRacaId(): ?int {
            return $this->raca_id;
        }
        public function setRacaId(?int $raca_id): void {
            $this->raca_id = $raca_id;
        }

        public function getCaminhoFoto(): ?string {
            return $this->caminho_foto;
        }
        public function setCaminhoFoto(?string $caminho_foto): void {
            $this->caminho_foto = $caminho_foto;
        }

        public function getRegistroGeralAnimal(): ?string {
            return $this->registro_geral_animal;
        }
        public function setRegistroGeralAnimal(?string $registro_geral_animal): void {
            $this->registro_geral_animal = $registro_geral_animal;
        }

        public function getPhotoPath(): ?string {
            return $this->photo_path;
        }
        public function setPhotoPath(?string $photo_path): void {
            $this->photo_path = $photo_path;
        }

        public function getDataNascimento(): ?string {
            return $this->data_nascimento;
        }
        public function setDataNascimento(?string $data_nascimento): void {
            $this->data_nascimento = $data_nascimento;
        }

        public function getDataObito(): ?string {
            return $this->data_obito;
        }
        public function setDataObito(?string $data_obito): void {
            $this->data_obito = $data_obito;
        }

        public function getSexo(): ?string {
            return $this->sexo;
        }
        public function setSexo(?string $sexo): void {
            $this->sexo = $sexo;
        }

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

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

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