<?php

namespace App\Models;

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

class Organization extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'entity_type',
        'contact_phone',
        'city',
        'country_code',
        'notes',
        'google_maps_api_key',
        'gemini_api_key',
        'google_maps_country',
        'owner_user_id',
        'is_active',
    ];

    protected function casts(): array
    {
        return [
            'is_active' => 'boolean',
        ];
    }

    public static function entityTypes(): array
    {
        return [
            'ORGANIZATION',
            'ARTIST',
            'GROUP',
            'MUSICIAN',
        ];
    }

    public function ownerUser()
    {
        return $this->belongsTo(User::class, 'owner_user_id');
    }

    public function users()
    {
        return $this->hasMany(User::class);
    }

    public function mariachiGroups()
    {
        return $this->hasMany(MariachiGroup::class);
    }
}
