<?php
namespace App\Entity;
use App\Enum\TodoPriorityEnum;
use App\Enum\TodoStatusEnum;
use App\Enum\TodoTypeEnum;
use App\Repository\TodosRepository;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* @ORM\Entity(repositoryClass=TodosRepository::class)
* @ORM\Table(name="todos")
* @ORM\HasLifecycleCallbacks
*/
class Todos
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
* @Groups({"todo@ref", "todo@base", "todo@core"})
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
* @Groups({"todo@base", "todo@core"})
*/
private $title;
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"todo@core"})
*/
private $description;
/**
* Ham kullanici (sesli) konusma metni — AI ozetinden ayri, kullanici duzenleyebilir.
* @ORM\Column(type="text", nullable=true)
* @Groups({"todo@core"})
*/
private $transcript;
/**
* Degerler: TodoPriorityEnum. DB tarafinda gercek ENUM kolonu (todo_priority_type).
*
* @ORM\Column(type="todo_priority_type")
* @Groups({"todo@core"})
*/
private $priority = TodoPriorityEnum::MEDIUM;
/**
* Degerler: TodoTypeEnum. DB tarafinda gercek ENUM kolonu (todo_type).
*
* @ORM\Column(type="todo_type")
* @Groups({"todo@core"})
*/
private $type = TodoTypeEnum::IMPROVEMENT;
/**
* @ORM\Column(type="string", length=100, nullable=true)
* @Groups({"todo@core"})
*/
private $module;
/**
* Degerler: TodoStatusEnum. DB tarafinda gercek ENUM kolonu (todo_status_type).
*
* @ORM\Column(type="todo_status_type")
* @Groups({"todo@core"})
*/
private $status = TodoStatusEnum::PENDING;
/**
* @ORM\Column(type="text", nullable=true)
* @Groups({"todo@core"})
*/
private $admin_note;
/**
* @ORM\Column(type="boolean", options={"default": false})
* @Groups({"todo@core"})
*/
private $is_system = false;
/**
* @ORM\Column(type="boolean", options={"default": false})
* @Groups({"todo@core"})
*/
private $assign_to_ai = false;
/**
* Degerler: TodoAiStatusEnum. DB tarafinda gercek ENUM kolonu (todo_ai_status_type).
*
* @ORM\Column(type="todo_ai_status_type", nullable=true)
* @Groups({"todo@core"})
*/
private $ai_status;
/**
* @ORM\Column(type="string", length=120, nullable=true)
* @Groups({"todo@core"})
*/
private $ai_branch;
/**
* Ekran goruntusu / belge dosya adlari (mini havuz — DB'de sadece dosya adi,
* web path runtime'da FE'de /assets/todo_documents/{name} ile kurulur).
*
* @ORM\Column(type="json", nullable=true)
* @Groups({"todo@core"})
*/
private $documents = [];
/**
* @ORM\ManyToOne(targetEntity=User::class)
* @ORM\JoinColumn(nullable=false)
* @Groups({"todo@user"})
*/
private $user;
/**
* @ORM\Column(type="datetime")
* @Groups({"todo@core"})
*/
private $created_at;
/**
* @ORM\Column(type="datetime")
* @Groups({"todo@core"})
*/
private $updated_at;
/**
* Bu todo'yu "Done" işaretleyen admin'in user id'si — confirm bildirimini o admin'e göndermek için.
* @ORM\Column(type="integer", nullable=true)
* @Groups({"todo@core"})
*/
private $done_by_admin_id;
/**
* AI'nin bu todo icin hesapladigi tahmini efor — INSAN GELISTIRICI saati
* (AI'nin kendi implement suresi DEGIL). 8 saat = 1 is gunu.
* Kullanici formundan gelmez; sadece analiz akisi yazar (bkz. ai-estimate ucu),
* bu yuzden upsertTodo'nun hydrate listesine EKLENMEZ — aksi halde todo
* duzenlenince sessizce silinir.
*
* @ORM\Column(type="float", nullable=true)
* @Groups({"todo@core"})
*/
private $ai_estimate_hours;
/**
* Tahminin gerekcesi — hangi dosyalar, neden bu kadar, riskler, kalan isler.
* Kartta gosterilmez; todo detayinda okunur.
*
* @ORM\Column(type="text", nullable=true)
* @Groups({"todo@core"})
*/
private $ai_estimate_note;
/**
* Analizin yapildigi an. Bayat tahmin tespiti bunun uzerinden yapilir:
* ai_estimated_at < updated_at ise todo analizden sonra degismis demektir,
* FE tahmini "guncel degil" olarak isaretler.
*
* @ORM\Column(type="datetime", nullable=true)
* @Groups({"todo@core"})
*/
private $ai_estimated_at;
/**
* @ORM\PrePersist
*/
public function onPrePersist(): void
{
$this->created_at = new \DateTime();
$this->updated_at = new \DateTime();
}
/**
* @ORM\PreUpdate
*/
public function onPreUpdate(): void
{
$this->updated_at = new \DateTime();
}
public function getId(): ?int { return $this->id; }
public function getDoneByAdminId(): ?int { return $this->done_by_admin_id; }
public function setDoneByAdminId(?int $done_by_admin_id): self { $this->done_by_admin_id = $done_by_admin_id; return $this; }
public function getAiEstimateHours(): ?float { return $this->ai_estimate_hours; }
public function setAiEstimateHours(?float $ai_estimate_hours): self { $this->ai_estimate_hours = $ai_estimate_hours; return $this; }
public function getAiEstimateNote(): ?string { return $this->ai_estimate_note; }
public function setAiEstimateNote(?string $ai_estimate_note): self { $this->ai_estimate_note = $ai_estimate_note; return $this; }
public function getAiEstimatedAt(): ?\DateTimeInterface { return $this->ai_estimated_at; }
public function setAiEstimatedAt(?\DateTimeInterface $ai_estimated_at): self { $this->ai_estimated_at = $ai_estimated_at; return $this; }
public function getTitle(): ?string { return $this->title; }
public function setTitle(string $title): self { $this->title = $title; return $this; }
public function getDescription(): ?string { return $this->description; }
public function setDescription(?string $description): self { $this->description = $description; return $this; }
public function getTranscript(): ?string { return $this->transcript; }
public function setTranscript(?string $transcript): self { $this->transcript = $transcript; return $this; }
public function getPriority(): ?string { return $this->priority; }
public function setPriority(string $priority): self { $this->priority = $priority; return $this; }
public function getType(): ?string { return $this->type; }
public function setType(string $type): self { $this->type = $type; return $this; }
public function getModule(): ?string { return $this->module; }
public function setModule(?string $module): self { $this->module = $module; return $this; }
public function getStatus(): ?string { return $this->status; }
public function setStatus(string $status): self { $this->status = $status; return $this; }
public function getAdminNote(): ?string { return $this->admin_note; }
public function setAdminNote(?string $admin_note): self { $this->admin_note = $admin_note; return $this; }
public function getIsSystem(): bool { return (bool) $this->is_system; }
public function setIsSystem(bool $is_system): self { $this->is_system = $is_system; return $this; }
public function getAssignToAi(): bool { return (bool) $this->assign_to_ai; }
public function setAssignToAi(bool $assign_to_ai): self { $this->assign_to_ai = $assign_to_ai; return $this; }
public function getAiStatus(): ?string { return $this->ai_status; }
public function setAiStatus(?string $ai_status): self { $this->ai_status = $ai_status; return $this; }
public function getAiBranch(): ?string { return $this->ai_branch; }
public function setAiBranch(?string $ai_branch): self { $this->ai_branch = $ai_branch; return $this; }
public function getDocuments(): ?array { return $this->documents ?? []; }
public function setDocuments(?array $documents): self { $this->documents = $documents ?? []; return $this; }
public function getUser(): ?User { return $this->user; }
public function setUser(?User $user): self { $this->user = $user; return $this; }
public function getCreatedAt(): ?\DateTime { return $this->created_at; }
public function getUpdatedAt(): ?\DateTime { return $this->updated_at; }
}