<?php

namespace Modules\Travel\Entities;

use App\Models\User;
use App\Models\Branch;
use App\Models\Upload;
use App\Models\Company\Company;
use App\Models\Traits\BranchTrait;
use App\Models\Traits\CompanyTrait;
use Illuminate\Database\Eloquent\Model;
use Modules\Travel\Entities\TravelPlan;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class TravelWorkflow extends Model
{
    use HasFactory, CompanyTrait, BranchTrait;

    protected $fillable = [
        'employee_id',
        'date',
        'start_time',
        'calls_made',
        'positive_leads',
        'total_sales',
        'pending_leads',
        'pending_leads_other',
        'recovery_today',
        'recovery_today_other',
        'daily_report_summary',
        'complaints_comments',
        'file_id',
        'rating',
        'created_by',
        'updated_by',
        'company_id',
        'branch_id',
    ];

    public function travelPlan()
    {
        return $this->belongsTo(TravelPlan::class, 'travel_plan_id');
    }

    public function file()
    {
        return $this->belongsTo(Upload::class, 'file_id');
    }

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

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

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

    public function company()
    {
        return $this->belongsTo(Company::class, 'company_id');
    }

    public function branch()
    {
        return $this->belongsTo(Branch::class, 'branch_id');
    }
}
