<?php

declare(strict_types=1);

namespace App\DTOs\Uploads;

final class UploadValidationResult
{
    public function __construct(
        public readonly bool $ok,
        public readonly string $reason,
        public readonly ?int $width,
        public readonly ?int $height,
        public readonly ?string $mime,
        public readonly ?int $size
    ) {
    }

    public static function ok(int $width, int $height, string $mime, int $size): self
    {
        return new self(true, '', $width, $height, $mime, $size);
    }

    public static function fail(string $reason, ?int $width = null, ?int $height = null, ?string $mime = null, ?int $size = null): self
    {
        return new self(false, $reason, $width, $height, $mime, $size);
    }
}
