<?php

namespace App\Models;

use App\Models\Traits\HasHexId;
use Illuminate\Database\Eloquent\Model;

class Organization extends Model
{
    use HasHexId;

    protected $table = 'organizations';
    public $incrementing = false;
    protected $keyType = 'string';
    public $timestamps = false;

    protected $fillable = ['id', 'owner_id', 'primary_hue', 'created_at'];

    protected $casts = [
        'primary_hue' => 'integer',
    ];

    public function owner()
    {
        return $this->belongsTo(User::class, 'owner_id', 'id');
    }

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