<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\DB;


class Company extends Model
{
    use HasFactory;
    use SoftDeletes;

    public function __construct()
    {
        setTenant();
    }

    protected $fillable = [
        'name',
        'business_name',
        'logo',
        'phone',
        'email',
        'pec',
        'costitution_date',
        'address',
        'zip',
        'city_id',
        'country_id',
        'operational_headquarters',
        'fiscal_code',
        'vat',           
        'sdi_code',
        'ateco_code',            
        'enabled',
    ];

    public function country()
    {
        return $this->belongsTo(\App\Models\Country::class);
    }

    public function city()
    {
        return $this->belongsTo(\App\Models\City::class);
    }

    public function activities()
    {
        return $this->hasMany(\App\Models\CompanyActivity::class);
    }

    public function rates()
    {
        return $this->hasMany(\App\Models\CompanyActivity::class);
    }

    public function services()
    {
        return $this->hasMany(\App\Models\CompanyActivity::class);
    }

}
