<?php

namespace App\Events;

use Illuminate\Foundation\Events\Dispatchable;
use Mtc\MercuryDataModels\ScheduledTask;
use Mtc\MercuryDataModels\ScheduledTaskRun;

class ScheduledTaskFinished
{
    use Dispatchable;

    public function __construct(
        public readonly ScheduledTask $task,
        public readonly ScheduledTaskRun $run,
    ) {
    }

    public function succeeded(): bool
    {
        return $this->run->status === ScheduledTaskRun::STATUS_COMPLETED;
    }
}
