<?php

declare(strict_types=1);

namespace App\Scolarite\Domain\ValueObject;

use App\Administration\Domain\Model\SchoolClass\ClassId;

final readonly class ClassValidationResult
{
    private function __construct(
        public ClassId $classId,
        public bool $valid,
        public ?string $error,
        public ?string $warning,
    ) {
    }

    public static function success(ClassId $classId, ?string $warning = null): self
    {
        return new self($classId, true, null, $warning);
    }

    public static function failure(ClassId $classId, string $error): self
    {
        return new self($classId, false, $error, null);
    }
}
