<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class FeaturedPayment extends Model
{
   protected $table = 'featured_payments';

    protected $fillable = [
        'payment_number',
        'user_id',
        'listing_id',
        'payment_id',
        'amount',
        'currency',
        'payment_method',
        'status',
        'featured_start_at',
        'featured_end_at',
        'duration_days',
        'transaction_id',
        'paid_at',
        'receipt_url',
        'refunded_amount',
        'refunded_at',
        'refund_reason',
        'stripe_payment_intent_id',
        'stripe_charge_id',
        'metadata',
    ];

    protected $casts = [
        'featured_start_at' => 'datetime',
        'featured_end_at'   => 'datetime',
        'paid_at'           => 'datetime',
        'refunded_at'       => 'datetime',
        'metadata'          => 'array',
    ];


     public function user()
    {
        return $this->belongsTo(User::class);
    }

    public function listing()
    {
        return $this->belongsTo(Listing::class);
    }

    public function payment()
    {
        return $this->belongsTo(Payment::class);
    }
}
