<?php

namespace App\Models;

# use Illuminate\Database\Eloquent\Model;

class Note extends Model
{
    protected $table = "note";

    public function client()
    {
        return $this->hasOne(Client::class, 'id', 'client_id');
    }

    public function hcpPro()
    {
        return $this->hasOne(Pro::class, 'id', 'hcp_pro_id');
    }

    public function allyPro()
    {
        return $this->hasOne(Pro::class, 'id', 'ally_pro_id');
    }

    public function bills()
    {
        return $this->hasMany(Bill::class, 'note_id', 'id');
    }

    public function sections()
    {
        return $this->hasMany(Section::class, 'note_id', 'id')
            ->where('is_active', true)
            ->orderBy('position_index', 'asc');
    }
}
