<?php

namespace KupShop\GraphQLBundle\ApiAdmin\Types;

use TheCodingMachine\GraphQLite\Annotations\Field;
use TheCodingMachine\GraphQLite\Annotations\Type;

/**
 * @Type()
 */
class AdminUser
{
    private $adminUser;

    public function __construct(array $adminUser)
    {
        $this->adminUser = $adminUser;
    }

    /**
     * @Field()
     */
    public function getId(): int
    {
        return $this->adminUser['id'];
    }

    /**
     * @Field()
     */
    public function getName(): ?string
    {
        return $this->adminUser['name'] ?? '';
    }

    /**
     * @Field()
     */
    public function getLogin(): string
    {
        return $this->adminUser['login'];
    }

    /**
     * @Field()
     */
    public function getEmail(): string
    {
        return $this->adminUser['email'];
    }

    /**
     * @Field()
     */
    public function getPrivilege(): string
    {
        return $this->adminUser['privilege'];
    }

    /**
     * @Field()
     */
    public function getData(): ?string
    {
        return json_encode($this->adminUser['data'] ?? []);
    }
}
