<?php
/*
 * Copyright 2026 Alessandro Chiapparini <sprint_planer_web@chiapparini.org>
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * See the LICENSE file in the project root for the full license text.
 */

declare(strict_types=1);

namespace App\Domain;

final class SprintWorker
{
    public function __construct(
        public readonly int    $id,
        public readonly int    $sprintId,
        public readonly int    $workerId,
        public readonly string $workerName,
        public readonly float  $rtb,
        public readonly int    $sortOrder,
    ) {
    }

    /**
     * Snapshot of the sprint_workers row as stored in the DB (excludes the
     * denormalised worker name which belongs to the workers table).
     */
    public function toAuditSnapshot(): array
    {
        return [
            'id'         => $this->id,
            'sprint_id'  => $this->sprintId,
            'worker_id'  => $this->workerId,
            'rtb'        => $this->rtb,
            'sort_order' => $this->sortOrder,
        ];
    }
}
