<?php

namespace App\Models\Environment;

use Illuminate\Database\Eloquent\Model;

class WebhookIntegration extends Model
{
  //* Associated Table & Primary Key
    protected $table = 'webhook_integrations';
    protected $primaryKey = 'id';

  //* Fillable Fields
    protected $fillable = [
        'business_id',
        'provider',
        'name',
        'endpoint_url',
        'remote_id',
        'secret',
        'events',
        'is_active',
        'meta',
    ];

  //* Cast Columns
    protected $casts = [
        'events'    => 'array',
        'is_active' => 'boolean',
        'meta'      => 'array',
    ];

  //* Relationships
    public function business()
    {
        return $this->belongsTo(Business::class);
    }
}
