$metrics * @param array> $observationPatients * @param array> $unwantedEvents * @param array|null $rawPayload */ public function __construct( public int $departmentId, public int $userId, public ?int $actorUserId, public DateTimeImmutable $periodStart, public DateTimeImmutable $periodEnd, public array $metrics = [], public array $observationPatients = [], public array $unwantedEvents = [], public ?int $reportId = null, public string $status = 'draft', public string $reportType = 'daily', public bool $autoFill = false, public ?array $rawPayload = null, public ?int $persistedReportId = null, public ?DateTimeImmutable $createdAt = null, public ?DateTimeImmutable $sentAt = null, ) {} public function toContext(): ReportContext { return new ReportContext( departmentId: $this->departmentId, userId: $this->userId, actorUserId: $this->actorUserId, periodStart: $this->periodStart, periodEnd: $this->periodEnd, reportType: $this->reportType, metadata: [ 'auto_fill' => $this->autoFill, ], ); } public function toSnapshot(): ReportSnapshot { return new ReportSnapshot( departmentId: $this->departmentId, userId: $this->userId, actorUserId: $this->actorUserId, periodStart: $this->periodStart, periodEnd: $this->periodEnd, status: $this->status, autoFill: $this->autoFill, metrics: $this->metrics, observationPatients: $this->observationPatients, unwantedEvents: $this->unwantedEvents, reportId: $this->reportId, createdAt: $this->createdAt, sentAt: $this->sentAt, reportType: $this->reportType, ); } /** * @param array $payload */ public function withRawPayload(array $payload): self { return new self( departmentId: $this->departmentId, userId: $this->userId, actorUserId: $this->actorUserId, periodStart: $this->periodStart, periodEnd: $this->periodEnd, metrics: $this->metrics, observationPatients: $this->observationPatients, unwantedEvents: $this->unwantedEvents, reportId: $this->reportId, status: $this->status, reportType: $this->reportType, autoFill: $this->autoFill, rawPayload: $payload, persistedReportId: $this->persistedReportId, createdAt: $this->createdAt, sentAt: $this->sentAt, ); } public function withPersistedReportId(int $reportId): self { return new self( departmentId: $this->departmentId, userId: $this->userId, actorUserId: $this->actorUserId, periodStart: $this->periodStart, periodEnd: $this->periodEnd, metrics: $this->metrics, observationPatients: $this->observationPatients, unwantedEvents: $this->unwantedEvents, reportId: $this->reportId, status: $this->status, reportType: $this->reportType, autoFill: $this->autoFill, rawPayload: $this->rawPayload, persistedReportId: $reportId, createdAt: $this->createdAt, sentAt: $this->sentAt, ); } }