<?php

namespace Src\Modules\Auth\Dto\Admin;

use Src\Modules\Auth\Interfaces\Dto\Admin\IAdminResource;

class AdminResource implements IAdminResource
{
    use AdminTrait;

    public function toArray(array $fields = []): array
    {
        if(!$fields){
            $fields = ['id',];
        }
        $result = [];
        if(in_array('id', $fields)){
            $result['id'] = $this->id;
        }
        if(in_array('email', $fields)){
            $result['email'] = $this->email;
        }
        return $result;
    }

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

    public function getEditFormUrl(): string
    {
        return route('admin.auth.admins.form', ['admin-id' => $this->id]);
    }

    public function getDeleteUrl(): string
    {
        return route('admin.auth.admins.deleteAdmin', ['admin-id' => $this->id]);
    }
}