<?php

declare(strict_types=1);

namespace App\Support\BackupHealth;

final readonly class BackupHealthActionTarget
{
    public const SURFACE_BACKUP_SETS_INDEX = 'backup_sets_index';

    public const SURFACE_BACKUP_SET_VIEW = 'backup_set_view';

    public const SURFACE_BACKUP_SCHEDULES_INDEX = 'backup_schedules_index';

    public function __construct(
        public string $surface,
        public ?int $recordId,
        public string $label,
        public string $reason,
    ) {}

    public static function backupSetsIndex(string $reason, string $label = 'Open backup sets'): self
    {
        return new self(
            surface: self::SURFACE_BACKUP_SETS_INDEX,
            recordId: null,
            label: $label,
            reason: $reason,
        );
    }

    public static function backupSetView(int $recordId, string $reason, string $label = 'Open latest backup'): self
    {
        return new self(
            surface: self::SURFACE_BACKUP_SET_VIEW,
            recordId: $recordId,
            label: $label,
            reason: $reason,
        );
    }

    public static function backupSchedulesIndex(string $reason, string $label = 'Open backup schedules'): self
    {
        return new self(
            surface: self::SURFACE_BACKUP_SCHEDULES_INDEX,
            recordId: null,
            label: $label,
            reason: $reason,
        );
    }
}
