<?php
namespace App\Services;
use App\Enums\CheckFrequency;use Carbon\CarbonImmutable;
final class NextCheckAtCalculator {public function calculate(CheckFrequency|string $frequency,?CarbonImmutable $from=null):CarbonImmutable{$f=$frequency instanceof CheckFrequency?$frequency:CheckFrequency::from($frequency);$from=$from?:CarbonImmutable::now('UTC');return $f===CheckFrequency::Daily?$from->addDay():$from->addWeek();}}