<?php

namespace App\Models;

use CodeIgniter\Model;

class CreditCostModel extends Model
{
    protected $table         = 'credit_costs';
    protected $allowedFields = ['action', 'credit_cost'];

    public function costFor(string $action): int
    {
        $row = $this->where('action', $action)->first();
        return $row ? (int) $row['credit_cost'] : 1;
    }
}
