<?php

namespace App\Models;

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

class Company extends Model
{
    use HasFactory;

    protected $fillable = [
        'apodo',
        'estado',
        'logo_path',
        'name',
        'tax_id',
        'address',
        'phone',
        'email',
        'website',
        'type',
        'notes',
    ];

    protected $dates = ['deleted_at'];

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

    public function projects()
    {
        return $this->belongsToMany(Project::class, 'company_project')
            ->withPivot('role_in_project')
            ->withTimestamps();
    }
}
