<?php

declare(strict_types=1);

final class MyronUpdatePackageResult
{
    /**
     * @param array<string, mixed> $manifest
     * @param list<string> $errors
     * @param list<string> $warnings
     * @param list<string> $entries
     */
    public function __construct(
        public readonly bool $ok,
        public readonly array $manifest,
        public readonly array $errors,
        public readonly array $warnings,
        public readonly array $entries,
    ) {
    }

    /**
     * @param array<string, mixed> $manifest
     * @param list<string> $warnings
     * @param list<string> $entries
     */
    public static function success(array $manifest, array $warnings, array $entries): self
    {
        return new self(true, $manifest, [], $warnings, $entries);
    }

    /**
     * @param list<string> $errors
     * @param array<string, mixed> $manifest
     * @param list<string> $warnings
     * @param list<string> $entries
     */
    public static function failure(array $errors, array $manifest = [], array $warnings = [], array $entries = []): self
    {
        return new self(false, $manifest, $errors, $warnings, $entries);
    }
}
