<?php

namespace App\Modules\VisaMasterPaymentOrder\Models;

use App\Modules\OnlinePayment\Models\OnlinePayment;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Support\Carbon;

/**
 * @property int $id
 * @property int $visa_master_payment_order_id
 * @property int $online_payment_id
 * @property string $payer_name
 * @property string $payer_card
 * @property string $payment_order_number
 * @property string $tmt_payment_amount
 * @property string $usd_payment_amount
 * @property bool $paid
 * @property bool $synced_with_system
 * @property Carbon $created_at
 * @property Carbon $updated_at
 */
class VisaMasterPaymentOrderItem extends Model
{
    /**
     * Table
     *
     * @var string
     */
    protected $table = 'visa_master_payment_order_items';

    /**
     * Guarded attributes
     */
    protected $guarded = [];

    /**
     * Parent order
     *
     * @return BelongsTo<VisaMasterPaymentOrder, $this>
     */
    public function parent(): BelongsTo
    {
        return $this->belongsTo(VisaMasterPaymentOrder::class, 'visa_master_payment_order_id');
    }

    /**
     * Online payment
     *
     * @return BelongsTo<OnlinePayment, $this>
     */
    public function onlinePayment(): BelongsTo
    {
        return $this->belongsTo(OnlinePayment::class, 'online_payment_id');
    }
}
