<?php

namespace App\DTOs;

class VerifyAccountDTO
{
    public string $accountNumber;
    public string $accountName;
    public string $bankCode;
    public string $bankName;

    public function __construct(string $accountNumber, string $accountName, string $bankCode, string $bankName)
    {
        $this->accountNumber = $accountNumber;
        $this->accountName = $accountName;
        $this->bankCode = $bankCode;
        $this->bankName = $bankName;
    }

    public static function fromArray(array $data): self
    {
        return new self(
            $data['account_number'] ?? '',
            $data['account_name'] ?? '',
            $data['bank_code'] ?? '',
            $data['bank_name'] ?? ''
        );
    }

    public function toArray(): array
    {
        return [
            'account_number' => $this->accountNumber,
            'account_name' => $this->accountName,
            'bank_code' => $this->bankCode,
            'bank_name' => $this->bankName,
        ];
    }
}