<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class UserChronicDisease extends Model
{
    protected $fillable = ['chronic_disease_id', 'user_id', 'chronic_disease_variant_id'];

    public function user()
    {
        return $this->belongsToMany(User::class, 'user_chronic_diseases', 'user_id', 'chronic_disease_id');
    }

    public function chronicDisease()
    {
        return $this->belongsTo(ChronicDisease::class, 'chronic_disease_id');
    }

    public function chronicDiseaseVariant()
    {
        return $this->hasMany(UserChronicDiseaseVariant::class, 'chronic_disease_id');
    }
}
