<?php declare(strict_types=1);

namespace App\Dto\Repository\CaptchaLogRepository;

use App\Enums\CaptchaLogType;

final class QuantityByDays
{
    private array $days = [];

    /**
     * @param string $day ("Y-m-d")
     * @param CaptchaLogType $type
     * @param int $count
     * @return void
     */
    public function add(string $day, CaptchaLogType $type, int $count): void
    {
        if (!isset($this->days[$day])) {
            $this->days[$day] = [];
        }
        $this->days[$day][$type->value] = $count;
    }

    /**
     * @param string $day ("Y-m-d")
     * @return array
     */
    public function getDay(string $day): array
    {
        return $this->days[$day] ?? [];
    }

    public function getDays(): array
    {
        return $this->days;
    }
}
