<?php

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

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

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

    public function __construct(
        protected readonly string $externalref
    ) {}

    public function defaultBody(): array
    {
        return [
            'type' => 1,
            'idtype' => 1,
            'accountnumber' => env('MOORLE_ACCOUNT_NUMBER'),
            'id' => $this->externalref
        ];
    }

    public function resolveEndpoint(): string
    {
        return '/transact/status';
    }
}