<?php

namespace App\Models;

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

class ApiProvider extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'api_url',
        'username',
        'password',
        'token',
        'plugin',
        'enabled',
    ];

    protected $casts = [
        'enabled' => 'boolean',
    ];

    public function styles()
    {
        return $this->hasMany(Style::class);
    }

    public function aiModels()
    {
        return $this->hasMany(AiModel::class, 'api_provider_id');
    }
}