<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Client extends Model
{

    protected $table = "client";

    public function notes()
    {
        return $this->hasMany(Note::class, 'client_id', 'id');
    }

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

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

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

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

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

    public function name_display(){
        return $this->name_first . ' '.$this->name_last;
    }

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

    public function medicareStatus(){
        // $this->mcn_reject_reason_code = 'not part b';
        return true ? true : (
        // return $this->is_mcn_valid_number ? true : (
            $this->mcn_reject_reason_code ? false : null
        );
    }
}
