uuid = Uuid::v4(); } public static function fromUploadDto(UploadDto $uploadDto, User $owner, string $type, Upload $instance = null): static { $instance = $instance ?? new static(); $instance ->setFilename($uploadDto->getFilename()) ->setOriginalFilename($uploadDto->getOriginalFilename()) ->setMimeType($uploadDto->getMimeType()) ->setSize($uploadDto->getSize()) ->setOwner($owner) ->setType($type) ; return $instance; } public function __toString() { return $this->getDisplayName() ?? $this->getOriginalFilename(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getType(): ?string { return $this->type; } public function setType(string $type): static { $this->type = $type; return $this; } public function getTypeLabel(): string { return match($this->getType()) { self::TYPE_PHOTO => 'Foto', self::TYPE_CERTIFICATE => 'Lizenz', self::TYPE_CONTRACT => 'Honorarvertrag', self::TYPE_INVOICE => 'Honorarnote', self::TYPE_DOCUMENT => 'Info', default => 'Dokument', }; } public function getStatus(): ?string { return $this->status; } public function setStatus(?string $status): static { $this->status = $status; return $this; } public function isConfirmed(): bool { return in_array($this->getStatus(), [static::STATUS_CHECKED, static::STATUS_PAID]); } public function isRejected(): bool { return static::STATUS_REJECTED === $this->getStatus(); } public function getFilename(): ?string { return $this->filename; } public function setFilename(string $filename): static { $this->filename = $filename; return $this; } public function getOriginalFilename(): ?string { return $this->originalFilename; } public function setOriginalFilename(string $originalFilename): static { $this->originalFilename = $originalFilename; return $this; } public function getDisplayName(): ?string { return $this->displayName; } public function setDisplayName(?string $displayName): static { $this->displayName = $displayName; return $this; } public function getSize(): ?int { return $this->size; } public function setSize(int $size): static { $this->size = $size; return $this; } public function getMimeType(): ?string { return $this->mimeType; } public function setMimeType(string $mimeType): static { $this->mimeType = $mimeType; return $this; } public function getOwner(): ?User { return $this->owner; } public function setOwner(?User $owner): static { $this->owner = $owner; return $this; } public function getDisposition(): ?Disposition { return $this->disposition; } public function setDisposition(?Disposition $disposition): static { $this->disposition = $disposition; return $this; } public function getComment(): ?string { return $this->comment; } public function setComment(?string $comment): static { $this->comment = $comment; return $this; } }