<?php
namespace App\Model\CustomerFile;
use App\Model\CustomerResource\CustomerResource;
use App\Model\Traits\ImportableObjectTrait;
use DateTime;
use Exception;
use Symfony\Component\HttpFoundation\File\File;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints as Assert;
use Vich\UploaderBundle\Mapping\Annotation as Vich;
/**
* @Vich\Uploadable
*/
class CustomerFile extends CustomerResource
{
use ImportableObjectTrait;
/**
* @Groups({
* "product:read",
* "list_resource",
* "read_resource",
* "read", "read_prospect", "read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
* @Assert\File(
* mimeTypes = {
* "image/png",
* "image/jpeg",
* "image/jpg",
* "application/pdf",
* "application/msword",
* "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
* "application/vnd.ms-excel",
* "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
* },
* maxSize = "10M",
* mimeTypesMessage = "Fichiers autorisés : .jpg, .jpeg, .png .pdf",
* maxSizeMessage = "Taille maximale autorisée : 10Mo",
* )
* @Vich\UploadableField(mapping="customer_file", fileNameProperty="fileName")
*
* @var File|null
*/
private $customerFile;
/**
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*
* @var string|null
*/
private $fileName;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","put_resource",
* "read", "read_prospect", "read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*/
private $fileLabel;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","put_resource", "read_task", "list","get_folder","read_mail",
* "customer_file:write", "customer_file:update"
* })
*/
private $realFileName;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder",
* "customer_file:write", "customer_file:update"
* })
*/
private $prospectId;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder",
* "customer_file:write", "customer_file:update"
* })
*/
private $taskId;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder",
* "customer_file:write", "customer_file:update"
* })
*/
private $productId;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder",
* "customer_file:write", "customer_file:update"
* })
*/
private $quoteId;
/**
* @var array|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*/
private $mailTypeIds;
/**
* @Groups({
* "product:read",
* "list_resource",
* "read_resource",
* "read_prospect","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*
* @var string|null
*/
private $contentUrl;
/**
* @Groups({
* "product:read",
* "list_resource",
* "read_resource",
* "read", "read_prospect","read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*
* @var string|null
*/
private $downloadLink;
/**
* @Groups({
* "product:read",
* "list_resource",
* "read_resource",
* "read", "read_prospect","read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*
* @var string|null
*/
private $deleteLink;
/**
* @var string|null
* @Groups({
* "list_resource",
* "read_resource","get_folder",
* "customer_file:write", "customer_file:update"
* })
*/
private $contactId;
/**
* @var string|null
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","put_resource",
* "read", "read_prospect", "read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*/
private $size;
/**
* @var bool
*/
private $shouldDelete = false;
/**
* @var bool
* @Groups({
* "product:read",
* "list_resource",
* "read_resource","put_resource",
* "read", "read_prospect", "read_task", "list","get_folder", "read_mail",
* "customer_file:write", "customer_file:update"
* })
*/
private $isQuotePdf = false;
/**
* @var int|null
* @Groups({
* "product:read",
* "list_resource", "read_resource",
* "read", "read_prospect", "read_task", "list","get_folder", "read_mail"
* })
*/
private $versionNumber;
/**
* @return string|null
*/
public function getFileLabel(): ?string
{
return $this->fileLabel;
}
/**
* @param string|null $fileLabel
*
* @return CustomerFile
*/
public function setFileLabel(?string $fileLabel): CustomerFile
{
$this->fileLabel = $fileLabel;
return $this;
}
/**
* @return string|null
*/
public function getRealFileName(): ?string
{
return $this->realFileName;
}
/**
* @param string|null $realFileName
*
* @return CustomerFile
*/
public function setRealFileName(?string $realFileName): CustomerFile
{
$this->realFileName = $realFileName;
return $this;
}
/**
* @param File|null $customerFile
*
* @return $this
*
* @throws Exception
*/
public function setCustomerFile(?File $customerFile): CustomerFile
{
$this->customerFile = $customerFile;
if ($customerFile) {
$this->updatedAt = new DateTime('now');
}
return $this;
}
/**
* @return string|null
*/
public function getFileName(): ?string
{
return $this->fileName;
}
/**
* @param string|null $fileName
*
* @return CustomerFile
*/
public function setFileName(?string $fileName): CustomerFile
{
$this->fileName = $fileName;
return $this;
}
/**
* @return string|null
*/
public function getProspectId(): ?string
{
return $this->prospectId;
}
/**
* @param string|null $prospectId
*
* @return CustomerFile
*/
public function setProspectId(?string $prospectId): CustomerFile
{
$this->prospectId = $prospectId;
return $this;
}
/**
* @return string|null
*/
public function getTaskId(): ?string
{
return $this->taskId;
}
/**
* @param string|null $taskId
*
* @return CustomerFile
*/
public function setTaskId(?string $taskId): CustomerFile
{
$this->taskId = $taskId;
return $this;
}
/**
* @return string|null
*/
public function getProductId(): ?string
{
return $this->productId;
}
/**
* @param string|null $productId
*
* @return CustomerFile
*/
public function setProductId(?string $productId): CustomerFile
{
$this->productId = $productId;
return $this;
}
/**
* @return string|null
*/
public function getQuoteId(): ?string
{
return $this->quoteId;
}
/**
* @param string|null $quoteId
*
* @return $this
*/
public function setQuoteId(?string $quoteId): self
{
$this->quoteId = $quoteId;
return $this;
}
/**
* @return File|null
*/
public function getCustomerFile(): ?File
{
return $this->customerFile;
}
/**
* @return string|null
*/
public function getContentUrl(): ?string
{
return $this->contentUrl;
}
/**
* @param string|null $contentUrl
*
* @return CustomerFile
*/
public function setContentUrl(?string $contentUrl): CustomerFile
{
$this->contentUrl = $contentUrl;
return $this;
}
/**
* @return string
*/
public function __toString(): string
{
return $this->contentUrl ?? '';
}
/**
* @return string|null
*/
public function getDownloadLink(): ?string
{
return $this->downloadLink;
}
/**
* @param string|null $downloadLink
*
* @return CustomerFile
*/
public function setDownloadLink(?string $downloadLink): CustomerFile
{
$this->downloadLink = $downloadLink;
return $this;
}
/**
* @return string|null
*/
public function getDeleteLink(): ?string
{
return $this->deleteLink;
}
/**
* @param string|null $deleteLink
*
* @return CustomerFile
*/
public function setDeleteLink(?string $deleteLink): CustomerFile
{
$this->deleteLink = $deleteLink;
return $this;
}
/**
* @return string|null
*/
public function getSize(): ?string
{
return $this->size;
}
/**
* @param string|null $size
*
* @return CustomerFile
*/
public function setSize(?string $size): CustomerFile
{
$this->size = $size;
return $this;
}
public function getContactId(): ?string
{
return $this->contactId;
}
public function setContactId(?string $contactId): self
{
$this->contactId = $contactId;
return $this;
}
/**
* @return array|null
*/
public function getMailTypeIds(): ?array
{
return $this->mailTypeIds;
}
/**
* @param array|null $mailTypeIds
*
* @return CustomerFile
*/
public function setMailTypeIds(?array $mailTypeIds): CustomerFile
{
$this->mailTypeIds = $mailTypeIds;
return $this;
}
/**
* @return bool
*/
public function isShouldDelete(): bool
{
return $this->shouldDelete;
}
/**
* @param bool $shouldDelete
*
* @return self
*/
public function setShouldDelete(bool $shouldDelete): self
{
$this->shouldDelete = $shouldDelete;
return $this;
}
/**
* @return bool
*/
public function isQuotePdf(): bool
{
return $this->isQuotePdf;
}
/**
* @param bool $isQuotePdf
*
* @return CustomerFile
*/
public function setIsQuotePdf(bool $isQuotePdf): CustomerFile
{
$this->isQuotePdf = $isQuotePdf;
return $this;
}
/**
* @return int|null
*/
public function getVersionNumber(): ?int
{
return $this->versionNumber;
}
/**
* @param int|null $versionNumber
*
* @return self
*/
public function setVersionNumber(?int $versionNumber): self
{
$this->versionNumber = $versionNumber;
return $this;
}
}