<?php

namespace App\Domain\POS\Models;

use App\Domain\POS\Enums\POSPaymentMethod;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class POSSplitPayment extends Model
{
    protected $table = 'pos_split_payments';

    protected $fillable = [
        'pos_transaction_id',
        'payment_method',
        'amount',
        'reference',
    ];

    protected $casts = [
        'payment_method' => POSPaymentMethod::class,
        'amount' => 'integer',
    ];

    public function transaction(): BelongsTo
    {
        return $this->belongsTo(POSTransaction::class, 'pos_transaction_id');
    }
}
