<?php

declare(strict_types=1);

namespace App\Dto;

class LimitCheckResult
{
    public function __construct(
        public readonly bool $allowed,
        public readonly int $current,
        public readonly int $max,
        public readonly float $percentUsed,
        public readonly string $message,
    ) {}

    public function isNearLimit(): bool
    {
        return $this->percentUsed >= 80.0;
    }

    public function isAtLimit(): bool
    {
        return $this->max > 0 && $this->current >= $this->max;
    }

    public static function unlimited(): self
    {
        return new self(
            allowed: true,
            current: 0,
            max: 0,
            percentUsed: 0.0,
            message: 'Sınırsız',
        );
    }
}
