<?php

namespace App\Domains\Integration\Models;

use App\Domains\Integration\Casts\EncryptedIntegrationData;
use Illuminate\Database\Eloquent\Model;

class TenantIntegration extends Model
{
    protected $table = 'tenant_integration';

    protected $fillable = [
        'integration_code',
        'tenant_code',
        'integration_data',
    ];

    protected $casts = [
        'integration_data' => EncryptedIntegrationData::class,
    ];

    public function integration()
    {
        return $this->belongsTo(Integration::class, 'integration_code', 'integration_code');
    }
}
