<?php

namespace App\DTOs;

class InitiatePaymentDto
{
    public bool $success;
    public string $message;
    public ?array $data;

    private function __construct(bool $success, string $message, ?array $data = null)
    {
        $this->success = $success;
        $this->message = $message;
        $this->data = $data;
    }

    public static function success(string $transactionReference, string $checkoutUrl): self
    {
        return new self(
            true,
            'Success',
            [
                'transactionReference' => $transactionReference,
                'checkoutUrl' => $checkoutUrl,
            ]
        );
    }

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