<?php

namespace App\Models;

use App\Models\Concerns\BelongsToBusiness;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class BillingTransaction extends Model
{
    use BelongsToBusiness, HasUuids;

    protected $fillable = ['plan_id', 'initiated_by', 'provider', 'reference', 'amount_kobo', 'currency', 'status', 'paid_at', 'provider_payload'];

    protected function casts(): array
    {
        return ['paid_at' => 'datetime', 'provider_payload' => 'array'];
    }

    public function plan(): BelongsTo
    {
        return $this->belongsTo(Plan::class);
    }
}
