<?php

namespace App\Http\Integrations\Imake\Requests\BulkClix;

use Saloon\Enums\Method;
use Saloon\Http\Request;
use Saloon\Contracts\Body\HasBody;
use Saloon\Traits\Body\HasJsonBody;

class MomoPay extends Request implements HasBody
{
    use HasJsonBody;
    /**
     * The HTTP method of the request
     */
    protected Method $method = Method::POST;

    public function __construct(protected readonly array $payload)
    {
        //
    }

    protected function defaultBody(): array
    {
        return [
            'amount' => $this->payload['amount'] ?? 2,
            'phone_number' => $this->payload['phone_number'],
            'network' => $this->payload['network'] ?? 'MTN', // MTN, TELECEL, AIRTELTIGO
            'transaction_id' => $this->payload['transaction_id'],
            'callback_url' => "https://webhook.site/319cf374-7463-49a2-993c-2afc67dced20", //env('BULKCLIX_CALLBACK_URL'),
            'reference' => env('BULKCLIX_BRAND_NAME')
        ];
    }

    /**
     * The endpoint for the request
     */
    public function resolveEndpoint(): string
    {
        return '/payment-api/momopay';
    }
}
