<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SyncOutbox extends Model
{
    use HasFactory;

    protected $table = 'sync_outboxes';

    protected $fillable = [
        'event_uuid',
        'origin_server_code',
        'farm_id',
        'aggregate_type',
        'aggregate_uuid',
        'action',
        'payload',
        'data_hash',
        'status',
        'attempts',
        'available_at',
        'last_attempt_at',
        'synced_at',
        'cloud_response',
        'last_error',
    ];

    protected $casts = [
        'payload' => 'array',
        'cloud_response' => 'array',
        'available_at' => 'datetime',
        'last_attempt_at' => 'datetime',
        'synced_at' => 'datetime',
    ];
}
