<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Model;

/** One call to an advertising platform, recorded whether it succeeded or not. */
#[Fillable([
    'campaign_id', 'actor', 'platform', 'transport', 'method', 'endpoint', 'ad_account_id',
    'mutating', 'dry_run', 'request', 'response', 'status', 'ok', 'object_id', 'error', 'duration_ms',
])]
class ApiCall extends Model
{
    protected function casts(): array
    {
        return [
            'request' => 'array',
            'response' => 'array',
            'mutating' => 'boolean',
            'dry_run' => 'boolean',
            'ok' => 'boolean',
        ];
    }
}
