<?php

namespace App\Models;

use CodeIgniter\Model;

class TaskRecurrenceModel extends Model
{
    protected $table            = 'task_recurrence_rules';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $useSoftDeletes   = false;
    protected $protectFields    = true;
    protected $allowedFields    = [
        'task_id',
        'recurrence_type',
        'interval_value',
        'weekly_days',
        'monthly_type',
        'monthly_day',
        'monthly_week_position',
        'monthly_weekday',
        'recurrence_time',
        'start_date',
        'end_date',
        'is_active',
    ];
    protected $useTimestamps = true;
    protected $dateFormat    = 'datetime';
    protected $createdField  = 'created_at';
    protected $updatedField  = 'updated_at';

    protected array $casts = [
        'weekly_days' => 'json-array',
    ];
}
