<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BillingHistory extends Model
{
    protected $table = 'billing_history';

    protected $fillable = [
        'business_id', 'subscription_id', 'invoice_number', 'amount', 'currency',
        'status', 'billing_date', 'paid_date', 'description',
    ];

    protected $casts = [
        'billing_date' => 'date',
        'paid_date' => 'date',
        'amount' => 'decimal:4',
    ];

    public function business(): BelongsTo { return $this->belongsTo(Business::class); }
    public function subscription(): BelongsTo { return $this->belongsTo(Subscription::class); }
}
