<?php

namespace App\Serp\Data;

final readonly class SerpTaskResult
{
    private function __construct(public bool $ready, public ?SerpResponse $response, public ?float $cost, public string $currency, public ?int $statusCode) {}

    public static function waiting(?int $statusCode = null): self
    {
        return new self(false, null, null, 'USD', $statusCode);
    }

    public static function ready(SerpResponse $response, ?float $cost = null, string $currency = 'USD', ?int $statusCode = null): self
    {
        return new self(true, $response, $cost, $currency, $statusCode);
    }
}
