<?php

namespace App\Domains\Integration\Models;

use Illuminate\Database\Eloquent\Model;

class Integration extends Model
{
    protected $table = 'integrations';

    protected $fillable = [
        'integration_code',
        'name',
        'url',
        'integration_data_schema',
        'requires_client_configuration',
    ];

    protected $casts = [
        'integration_data_schema' => 'array',
        'requires_client_configuration' => 'boolean',
    ];

    public function clientIntegrations()
    {
        return $this->hasMany(ClientIntegration::class, 'integration_code', 'integration_code');
    }
}
