<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * Suivi des utilisations de promotions
 */
class PromotionUsage extends Model
{
    protected $fillable = [
        'promotion_id',
        'user_id',
        'order_id',
        'discount_amount',
        'used_at',
    ];

    protected $casts = [
        'discount_amount' => 'decimal:2',
        'used_at' => 'datetime',
    ];

    public function promotion()
    {
        return $this->belongsTo(Promotion::class);
    }

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

    public function order()
    {
        return $this->belongsTo(Order::class);
    }
}
