<?php

namespace App\Notifications;

class DeliveryResult
{
    public function __construct(
        public bool $success,
        public string $channel,
        public ?string $providerMessageId = null,
        public ?string $error = null,
        public mixed $raw = null,
    ) {}

    public static function ok(string $channel, ?string $id = null, mixed $raw = null): self
    {
        return new self(true, $channel, $id, null, $raw);
    }

    public static function fail(string $channel, string $error, mixed $raw = null): self
    {
        return new self(false, $channel, null, $error, $raw);
    }
}
