<?php

namespace App\Models\Returns;

use App\Models\Concerns\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class RefundMethod extends Model
{
    use BelongsToTenant;

    public $timestamps = false;

    protected $table = 'refund_methods';

    protected $fillable = ['code', 'name', 'sort_order'];

    public const CASH = 'cash';

    public const CREDIT_NOTE = 'credit_note';

    public static function idOf(string $code): int
    {
        return (int) static::where('code', $code)->value('id');
    }
}
