<?php

namespace App\Models\Ecommerce\Product\Coupon;

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

class Coupon extends Model
{
    use HasFactory;

    /**
     * Discount by percentage (%)
     */
    public const DISCOUNT_PERCENTAGE = 'percentage';

    /**
     * Discount by fixed amount (ex: -10 TMT)
     */
    public const DISCOUNT_FIXED = 'fixed_amount';

    /**
     * @var array<int, string>
     */
    protected $fillable = [
        'code',
        'discount_type',
        'discount_value',
        'notes',
        'is_active',
    ];

    /**
     * Discount types
     */
    public static function discountTypes(): array
    {
        return [
            self::DISCOUNT_PERCENTAGE => __('Percentage'),
            self::DISCOUNT_FIXED => __('Fixed Amount'),
        ];
    }

    /**
     * Default discount type
     */
    public static function defaultDiscountType(): string
    {
        return self::DISCOUNT_PERCENTAGE;
    }
}
