<?php

namespace App\Data\Pagarme\Transfer;

use App\Data\Pagarme\PagarmeData;

final readonly class TransferRequestData extends PagarmeData
{
    public function __construct(
        public int    $amount,
        public string $recipientId,
    ) {
        self::requirePositiveInt($this->amount, 'amount');
        self::requireFilled($this->recipientId, 'recipient_id');
    }

    public function toArray(): array
    {
        return $this->filterFilledRecursive([
            'amount'       => $this->amount,
            'recipient_id' => $this->recipientId,
        ]);
    }
}
