<?php

namespace Modules\MedPortal\Entities;

use Illuminate\Database\Eloquent\Model;

/**
 * An online-payment intent against an ERP invoice (SIFA Phase 8).
 *
 * ⚠️ STUB — no real gateway. Staff mark it paid manually; the ERP transaction
 * stays the source of truth. Real gateway integration is BACKLOG.
 */
class MportalPaymentIntent extends Model
{
    protected $table = 'mportal_payment_intents';

    protected $guarded = ['id'];

    protected $casts = [
        'amount'  => 'decimal:4',
        'paid_at' => 'datetime',
    ];

    public const STATUSES = ['pending', 'paid', 'failed'];
    public const METHODS  = ['cash', 'card', 'online', 'insurance', 'other'];

    public function scopeForBusiness($query, $businessId)
    {
        return $query->where('business_id', $businessId);
    }
}
