<?php

namespace App\Modules\Integrations\Platform\Models;

use App\Modules\Admin\Tenancy\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class IntegrationWebhookDelivery extends Model
{
    use BelongsToTenant;

    protected $fillable = [
        'tenant_id',
        'webhook_id',
        'event_id',
        'attempt',
        'attempt_count',
        'first_attempted_at',
        'last_attempted_at',
        'dead_lettered_at',
        'exhausted_at',
        'duration_ms',
        'status',
        'response_status',
        'response_body',
        'error',
        'next_retry_at',
        'delivered_at',
        'request_id',
    ];

    protected $casts = [
        'next_retry_at' => 'datetime',
        'delivered_at' => 'datetime',
        'first_attempted_at' => 'datetime',
        'last_attempted_at' => 'datetime',
        'dead_lettered_at' => 'datetime',
        'exhausted_at' => 'datetime',
    ];
}

