<?php

declare(strict_types=1);

namespace App\Http\Resources;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class BankCardResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'user_id' => $this->user_id,
            'bank_name' => $this->bank_name,
            'card_number' => $this->card_number,
            'card_number_masked' => $this->maskedCardNumber(),
            'shaba' => $this->shaba,
            'account_holder_name' => $this->account_holder_name,
            'is_default' => (bool) $this->is_default,
            'status' => $this->status,
            'meta' => $this->meta,
            'created_at' => $this->created_at?->toISOString(),
            'updated_at' => $this->updated_at?->toISOString(),
        ];
    }
}
