<?php

namespace AutoAdmin\Bundle\Content\Entity;

use AutoAdmin\Bundle\Admin\Entity\Administrator;
use AutoAdmin\Bundle\Content\Entity\Traits\CreatedAtTrait;
use AutoAdmin\Bundle\Content\Entity\Traits\IdTrait;
use AutoAdmin\Bundle\Content\Entity\Traits\TitleTrait;
use AutoAdmin\Bundle\Content\Model\CreatedAtInterface;
use AutoAdmin\Bundle\Content\Model\IdInterface;
use AutoAdmin\Bundle\Content\Model\TitleInterface;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;

/**
 * Class Log
 * @package AutoAdmin\Bundle\Content\Entity
 */
#[ORM\Entity(repositoryClass: "AutoAdmin\Bundle\Content\Repository\LogRepository")]
class Log implements CreatedAtInterface, IdInterface, TitleInterface
{
    use IdTrait;
    use CreatedAtTrait;
    use TitleTrait;

    public const TYPE_CREATE = 'create';
    public const TYPE_UPDATE = 'update';
    public const TYPE_DELETE = 'delete';
    public const TYPE_CREATE_BRICK = 'create_brick';
    public const TYPE_UPDATE_BRICK = 'update_brick';
    public const TYPE_DELETE_BRICK = 'delete_brick';

    #[ORM\ManyToOne(targetEntity: Administrator::class, inversedBy: "logs")]
    private ?Administrator $administrator;

    #[ORM\Column(type: Types::STRING, length: 255)]
    private string $entity;

    #[ORM\Column(type: Types::STRING, length: 255)]
    private string $type;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $adminLink;

    #[ORM\Column(type: Types::TEXT, nullable: true)]
    private ?string $frontLink;

    #[ORM\Column(type: Types::STRING, length: 50)]
    private string $ip;

    public function getAdministrator(): ?Administrator
    {
        return $this->administrator;
    }

    public function setAdministrator(?Administrator $administrator): self
    {
        $this->administrator = $administrator;

        return $this;
    }

    public function getType(): string
    {
        return $this->type;
    }

    public function setType(string $type): self
    {
        $this->type = $type;

        return $this;
    }

    public function getEntity(): ?string
    {
        return $this->entity;
    }

    public function setEntity(string $entity): self
    {
        $this->entity = $entity;

        return $this;
    }

    public function getAdminLink(): ?string
    {
        return $this->adminLink;
    }

    public function setAdminLink(?string $adminLink): self
    {
        $this->adminLink = $adminLink;

        return $this;
    }

    public function getFrontLink(): ?string
    {
        return $this->frontLink;
    }

    public function setFrontLink(?string $frontLink): self
    {
        $this->frontLink = $frontLink;

        return $this;
    }

    public function getIp(): string
    {
        return $this->ip;
    }

    public function setIp(string $ip): self
    {
        $this->ip = $ip;

        return $this;
    }
}
