<?php

namespace App\Models;

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

class Activity extends Model
{
    use HasFactory, SoftDeletes;
    protected $table = "activities";
    protected $fillable  = [
        'id',
        'title',
        'description',
        'scheduled_at',
        'completed_at',
        'state_activity',
        'type_activity_id',
        'opportunity_id',
        'assigned_to',
        'entity_status',
        'created_at'
    ];

    protected $hidden = [
        'updated_at',
        'deleted_at',
        'created_by',
        'updated_by',
        'deleted_by',
    ];

    public function type_activity()
    {
        return $this->belongsTo(TypeActivity::class);
    }

    public function opportunity()
    {
        return $this->belongsTo(Opportunity::class);
    }
    public function user()
    {
        return $this->belongsTo(User::class, 'assigned_to');
    }
}
