<?php

namespace App\Models;

use App\Traits\BelongsToTenant;
use Illuminate\Database\Eloquent\Model;

class CrmActivity extends Model
{
    use BelongsToTenant;

    protected $fillable = [
        'tenant_id',
        'crm_lead_id',
        'renewal_opportunity_id',
        'activity_type',
        'notes',
        'created_by',
        'scheduled_at',
        'is_completed',
    ];

    protected $casts = ['scheduled_at' => 'datetime', 'is_completed' => 'boolean'];

    public function lead()
    {
        return $this->belongsTo(CrmLead::class, 'crm_lead_id');
    }

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