<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;

class PaymentProof extends Model
{
    protected $table = 'payment_proofs';

    protected $fillable = [
        'card_request_id',
        'transaction_number',
        'receipt_path',
        'amount_paid',
        'member_note',
        'status'
    ];

    // Disable auto-increment for UUID
    public $incrementing = false;
    protected $keyType = 'string';

    protected static function boot()
    {
        parent::boot();
        
        // Auto-generate UUID before creating
        static::creating(function ($model) {
            if (empty($model->{$model->getKeyName()})) {
                $model->{$model->getKeyName()} = (string) Str::uuid();
            }
        });
    }
}