<?php

/*
 * @codingStandardsIgnoreFile
 *
 * Auto generated file ignore for Code Sniffer
 */

namespace App\Entity;

use Carbon\Carbon;
use DateTime;
use Doctrine\ORM\Mapping as ORM;

/**
 * Image uploaded using CKEditor.
 *
 * @SuppressWarnings("PHPMD")
 * Auto generated class do not check mess
 */
#[ORM\Table(name: 'uploaded_image')]
#[ORM\Entity]
#[ORM\HasLifecycleCallbacks]
class UploadedImage
{
    /**
     * @var string
     */
    #[ORM\Column(name: 'filename', type: 'string', length: 100, nullable: false)]
    private $filename;

    /**
     * @var string
     */
    #[ORM\Column(name: 'mimetype', type: 'string', length: 100, nullable: false)]
    private $mimeType;

    /**
     * @var int
     */
    #[ORM\Column(name: 'size', type: 'integer', nullable: false)]
    private $size = 0;

    /**
     * @var int
     */
    #[ORM\Column(name: 'width', type: 'integer', nullable: false)]
    private $width = 0;

    /**
     * @var int
     */
    #[ORM\Column(name: 'height', type: 'integer', nullable: false)]
    private $height = 0;

    /**
     * @var DateTime
     */
    #[ORM\Column(name: 'created', type: 'datetime', nullable: false)]
    private $created;

    /**
     * @var string
     */
    #[ORM\Column(name: 'fileinfo', type: 'text', length: 32, nullable: false)]
    private $fileInfo;

    /**
     * @var string
     */
    #[ORM\Column(name: 'filehash', type: 'text', length: 64, nullable: false)]
    private $fileHash;

    /**
     * @var int
     */
    #[ORM\Column(name: 'id', type: 'integer')]
    #[ORM\Id]
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
    private $id;

    public function setFilename(string $filename): self
    {
        $this->filename = $filename;

        return $this;
    }

    public function getFilename(): string
    {
        return $this->filename;
    }

    public function setMimeType(string $mimeType): self
    {
        $this->mimeType = $mimeType;

        return $this;
    }

    public function getMimeType(): string
    {
        return $this->mimeType;
    }

    public function setWidth(int $width): self
    {
        $this->width = $width;

        return $this;
    }

    public function getWidth(): int
    {
        return $this->width;
    }

    public function setHeight(int $height): self
    {
        $this->height = $height;

        return $this;
    }

    public function getHeight(): int
    {
        return $this->height;
    }

    public function getCreated(): Carbon
    {
        return Carbon::instance($this->created);
    }

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

    /**
     * Triggered on insert.
     */
    #[ORM\PrePersist]
    public function onPrePersist()
    {
        $this->created = new DateTime('now');
    }

    public function setFileInfo(string $fileInfo): self
    {
        $this->fileInfo = $fileInfo;

        return $this;
    }

    public function getFileInfo(): ?string
    {
        return $this->fileInfo;
    }

    public function setFileHash(string $fileHash): self
    {
        $this->fileHash = $fileHash;

        return $this;
    }

    public function getFileHash(): ?string
    {
        return $this->fileHash;
    }

    public function getSize(): int
    {
        return $this->size;
    }

    public function setSize(int $size): self
    {
        $this->size = $size;

        return $this;
    }
}
