<?php

declare(strict_types=1);

namespace apexl\Io\modules\payment\Entity;

use apexl\entityCore\traits\HasCasts;
use apexl\Io\includes\Entity;

/**
 * PaymentToken — a tokenised payment method ref (card / bank / wallet)
 * held by the gateway, mirrored locally for picker UI.
 *
 * No sensitive data here — only the gateway's ref + brand + last-4 +
 * expiry metadata. The gateway retains the actual PAN / IBAN / etc.
 *
 * @property int         $id
 * @property int|null    $user_id           consumer-side user reference (null for guest)
 * @property string|null $consumer_customer_ref  consumer-side customer scope (e.g. Hermes EndUser id)
 * @property string      $gateway
 * @property string      $gateway_customer_ref
 * @property string      $gateway_token_ref
 * @property string      $type              'card' / 'sepa_debit' / 'paypal_account' / …
 * @property string|null $brand
 * @property string|null $last4
 * @property int|null    $exp_month
 * @property int|null    $exp_year
 * @property bool        $is_default
 * @property bool        $is_active
 * @property string|null $billing_name
 * @property string|null $billing_email
 * @property array|null  $meta
 * @property int         $created
 * @property int         $created_by
 * @property int|null    $modified
 * @property int|null    $modified_by
 */
class PaymentToken extends Entity
{
    use HasCasts;

    public final const string TABLE = 'payment_tokens';

    public function __construct()
    {
        parent::__construct(static::TABLE);
    }

    public function casts(): array
    {
        return [...parent::casts()];
    }
}
