Worker.php 782 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain;
  4. final class Worker
  5. {
  6. public function __construct(
  7. public readonly int $id,
  8. public readonly string $name,
  9. public readonly bool $isActive,
  10. public readonly float $defaultRtb,
  11. public readonly string $createdAt,
  12. public readonly string $updatedAt,
  13. ) {
  14. }
  15. /** Row snapshot for audit JSON. */
  16. public function toAuditSnapshot(): array
  17. {
  18. return [
  19. 'id' => $this->id,
  20. 'name' => $this->name,
  21. 'is_active' => $this->isActive ? 1 : 0,
  22. 'default_rtb' => $this->defaultRtb,
  23. 'created_at' => $this->createdAt,
  24. 'updated_at' => $this->updatedAt,
  25. ];
  26. }
  27. }