<?php

namespace FSPoster\App\Models;

use FSPoster\App\Providers\DB\BlogScope;
use FSPoster\App\Providers\DB\Model;

/**
 * Represents a workflow queue entry (table: workflow_queue).
 * The class is named WorkflowLog for historical reasons — the table was
 * originally workflow_logs and was repurposed as a full execution queue.
 *
 * @property int $id
 * @property int $workflow_id
 * @property int|null $workflow_action_id
 * @property string $when
 * @property string $driver
 * @property string $created_at
 * @property string $updated_at
 * @property string $request_data
 * @property string $response_data
 * @property string $data
 * @property string $event_data
 * @property string|null $planned_at
 * @property string|null $executed_at
 * @property int $attempt_count
 * @property string|null $dedupe_key
 * @property string|null $lock_token
 * @property string|null $locked_at
 * @property int|null $schedule_id
 * @property int|null $user_id
 * @property int|null $origin_schedule_id
 * @property int $chain_depth
 * @property string $status
 * @property string|null $error_msg
 * @property int $blog_id
 */

class WorkflowLog extends Model
{
    use BlogScope;

    protected static ?string $tableName = 'workflow_queue';

    public static array $writeableColumns = [
        'workflow_action_id',
        'workflow_id',
        'when',
        'driver',
        'planned_at',
        'executed_at',
        'attempt_count',
        'dedupe_key',
        'lock_token',
        'locked_at',
        'schedule_id',
        'user_id',
        'origin_schedule_id',
        'chain_depth',
        'request_data',
        'response_data',
        'data',
        'event_data',
        'blog_id',
        'status',
        'error_msg'
    ];
}
