<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class VendorOffer extends Model
{
    use HasFactory;

    protected $fillable = [
        'vendor_id',
        'title',
        'coupon_code',
        'discount_type',
        'discount_value',
        'description',
        'valid_until',
        'is_active',
    ];

    protected $casts = [
        'is_active' => 'boolean',
        'discount_value' => 'float',
        'valid_until' => 'date',
    ];

    public function vendor()
    {
        return $this->belongsTo(User::class, 'vendor_id');
    }
}
