<?php 
 
namespace App\Entity; 
 
use ApiPlatform\Metadata\ApiResource; 
use ApiPlatform\Metadata\GetCollection; 
use ApiPlatform\Metadata\Get; 
use App\Repository\LogsActionRepository; 
use App\Traits\AutoTimestampTrait; 
use Doctrine\DBAL\Types\Types; 
use Doctrine\ORM\Mapping as ORM; 
use Symfony\Component\Serializer\Annotation\Groups; 
 
#[ORM\Entity(repositoryClass: LogsActionRepository::class)] 
#[ORM\Table(name: 'logs_actions')] 
#[ApiResource( 
    operations: [ 
        new GetCollection(), 
        new Get(), 
    ], 
    normalizationContext: ['groups' => ['action.get']], 
    denormalizationContext: ['groups' => ['action.write']] 
)] 
class LogsAction 
{ 
    use AutoTimestampTrait; 
 
    #[ORM\Id] 
    #[ORM\GeneratedValue] 
    #[ORM\Column] 
    #[Groups(['action.get'])] 
    private ?int $id = null; 
 
    #[ORM\ManyToOne(targetEntity: User::class)] 
    #[ORM\JoinColumn(nullable: false, onDelete: 'CASCADE')] 
    #[Groups(['action.get', 'action.write'])] 
    private ?User $user = null; 
 
    #[ORM\Column(type: Types::STRING, length: 255, nullable: false)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $action = null; 
 
    #[ORM\Column(type: Types::STRING, length: 255, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $route = null; 
 
    #[ORM\Column(type: Types::STRING, length: 10, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $method = null; 
 
    #[ORM\Column(type: Types::STRING, length: 45, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $ipAddress = null; 
 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $userAgent = null; 
 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $requestData = null; 
 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $responseData = null; 
 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $dataBefore = null; 
 
    #[ORM\Column(type: Types::TEXT, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?string $dataAfter = null; 
 
    #[ORM\Column(type: Types::INTEGER, nullable: true)] 
    #[Groups(['action.get', 'action.write'])] 
    private ?int $statusCode = null; 
 
    #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)] 
    #[Groups(['session.get', 'session.write'])] 
    protected $createdAt; 
 
    #[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: false)] 
    #[Groups(['session.get', 'session.write'])] 
    protected $updatedAt; 
 
 
    public function getId(): ?int 
    { 
        return $this->id; 
    } 
 
    public function getUser(): ?User 
    { 
        return $this->user; 
    } 
 
    public function setUser(?User $user): static 
    { 
        $this->user = $user; 
        return $this; 
    } 
 
    public function getAction(): ?string 
    { 
        return $this->action; 
    } 
 
    public function setAction(string $action): static 
    { 
        $this->action = $action; 
        return $this; 
    } 
 
    public function getRoute(): ?string 
    { 
        return $this->route; 
    } 
 
    public function setRoute(?string $route): static 
    { 
        $this->route = $route; 
        return $this; 
    } 
 
    public function getMethod(): ?string 
    { 
        return $this->method; 
    } 
 
    public function setMethod(?string $method): static 
    { 
        $this->method = $method; 
        return $this; 
    } 
 
    public function getIpAddress(): ?string 
    { 
        return $this->ipAddress; 
    } 
 
    public function setIpAddress(?string $ipAddress): static 
    { 
        $this->ipAddress = $ipAddress; 
        return $this; 
    } 
 
    public function getUserAgent(): ?string 
    { 
        return $this->userAgent; 
    } 
 
    public function setUserAgent(?string $userAgent): static 
    { 
        $this->userAgent = $userAgent; 
        return $this; 
    } 
 
    public function getRequestData(): ?string 
    { 
        return $this->requestData; 
    } 
 
    public function setRequestData(?string $requestData): static 
    { 
        $this->requestData = $requestData; 
        return $this; 
    } 
 
    public function getResponseData(): ?string 
    { 
        return $this->responseData; 
    } 
 
    public function setResponseData(?string $responseData): static 
    { 
        $this->responseData = $responseData; 
        return $this; 
    } 
 
    public function getDataBefore(): ?string 
    { 
        return $this->dataBefore; 
    } 
 
    public function setDataBefore(?string $dataBefore): static 
    { 
        $this->dataBefore = $dataBefore; 
        return $this; 
    } 
 
    public function getDataAfter(): ?string 
    { 
        return $this->dataAfter; 
    } 
 
    public function setDataAfter(?string $dataAfter): static 
    { 
        $this->dataAfter = $dataAfter; 
        return $this; 
    } 
 
    public function getStatusCode(): ?int 
    { 
        return $this->statusCode; 
    } 
 
    public function setStatusCode(?int $statusCode): static 
    { 
        $this->statusCode = $statusCode; 
        return $this; 
    } 
    public function getCreatedAt(): ?\DateTimeInterface 
    { 
        return $this->createdAt; 
    } 
 
    public function setCreatedAt(?\DateTimeInterface $createdAt): static 
    { 
        $this->createdAt = $createdAt; 
        return $this; 
    } 
 
    public function getUpdatedAt(): ?\DateTimeInterface 
    { 
        return $this->updatedAt; 
    } 
 
    public function setUpdatedAt(?\DateTimeInterface $updatedAt): static 
    { 
        $this->updatedAt = $updatedAt; 
        return $this; 
    } 
}