<?php

namespace App\Modules\Academic\Models;

use CodeIgniter\Model;

/**
 * Dapodik sync job tracker for progress reporting.
 */
class DapodikSyncJobModel extends Model
{
    protected $table            = 'dapodik_sync_jobs';
    protected $primaryKey       = 'id';
    protected $useAutoIncrement = true;
    protected $returnType       = 'array';
    protected $useTimestamps    = true;
    protected $createdField     = 'created_at';
    protected $updatedField     = 'updated_at';
    protected $allowedFields    = [
        'type',
        'total_rows',
        'processed_rows',
        'status',
        'message',
        'started_at',
        'finished_at',
    ];

    public const STATUS_PENDING   = 'pending';
    public const STATUS_RUNNING   = 'running';
    public const STATUS_COMPLETED = 'completed';
    public const STATUS_FAILED    = 'failed';

    public const TYPE_STUDENTS = 'students';
    public const TYPE_CLASSES  = 'classes';
}
