<?php

declare(strict_types=1);

namespace apexl\Io\modules\payment\Entity;

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

/**
 * PaymentLog — append-only state-change audit for a Payment.
 *
 * Every status transition + every webhook ingestion writes a row. Used
 * for support diagnostics + dispute responses.
 *
 * @property int         $id
 * @property int         $payment_id
 * @property string      $from_status
 * @property string      $to_status
 * @property string|null $source                'gateway_webhook' / 'gateway_lookup' / 'admin' / 'system'
 * @property string|null $reason
 * @property array|null  $context
 * @property int         $created
 * @property int         $created_by
 */
class PaymentLog extends Entity
{
    use HasCasts;

    public final const string TABLE = 'payment_logs';

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

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