<?php

namespace App\Models;

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

class PwPromoUsage extends Model
{
    protected $table = 'pw_promo_usage';

    protected $fillable = [
        'promo_id',
        'user_id',
        'transaction_id',
        'discount_amount',
    ];

    protected $casts = [
        'promo_id' => 'integer',
        'user_id' => 'integer',
        'transaction_id' => 'integer',
        'discount_amount' => 'integer',
    ];

    public function promo(): BelongsTo
    {
        return $this->belongsTo(PwPromo::class, 'promo_id');
    }

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