<?php

namespace App\Models;

use App\Traits\Auditable;

use Illuminate\Database\Eloquent\Model;

/**
 * @property string $id
 * @property integer $users_id
 * @property string $identification
 * @property string $firstname
 * @property string $lastname
 * @property string $age
 * @property string $gender
 * @property string $email
 * @property string $phone
 * @property string $address
 * @property string $birthday
 * @property string $created_at
 * @property string $updated_at
 * @property User $user
 * @property Payment[] $payments
 * @property Especiality[] $especialities
 */
class UserProfile extends Model
{
    use Auditable;
    /**
     * The table associated with the model.
     * 
     * @var string
     */
    protected $table = 'user_profile';

    /**
     * The "type" of the auto-incrementing ID.
     * 
     * @var string
     */
    protected $keyType = 'string';

    /**
     * Indicates if the IDs are auto-incrementing.
     * 
     * @var bool
     */
    public $incrementing = false;

    /**
     * @var array
     */
    protected $fillable = ['users_id', 'firstname', 'lastname', 'age', 'gender', 'email', 'phone', 'address', 'birthday', 'created_at', 'updated_at'];

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function user()
    {
        return $this->belongsTo('App\Models\User', 'users_id');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function payments()
    {
        return $this->hasMany('App\Models\Payment');
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
     */
    public function especialities()
    {
        return $this->belongsToMany('App\Models\Especiality', 'user_profile_has_especiality');
    }
}
