<?php

namespace App\Dashboard\Stats;

use App\Support\DateRange;

abstract class DailySeriesStat implements SeriesStat
{
    final public function for(DateRange $range): SeriesResult
    {
        if (! $range->isBucketableByDay()) {
            return SeriesResult::tooWide();
        }

        return $this->series($range, $range->days());
    }

    /**
     * @param  array<int, string>  $days
     */
    abstract protected function series(DateRange $range, array $days): SeriesResult;
}
