<?php

namespace App\Models;

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

class GoogleSyncLog extends Model
{
    use HasFactory;

    protected $fillable = [
        'booking_id',
        'direction',
        'target',
        'payload_json',
        'response_json',
        'status',
        'attempts',
        'synced_at',
    ];

    protected function casts(): array
    {
        return [
            'payload_json' => 'array',
            'response_json' => 'array',
            'attempts' => 'integer',
            'synced_at' => 'datetime',
        ];
    }

    public function booking()
    {
        return $this->belongsTo(Booking::class);
    }
}
