<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Yajra\Oci8\Eloquent\OracleEloquent;

class Client extends OracleEloquent
{
    use HasFactory;

    protected $table = 'client';

    const CREATED_AT = 'DATE_CREATED';
    const UPDATED_AT = 'DATE_MODIFIED';
    protected $primaryKey = 'RID';

    protected $fillable = [
        'RID',
        'NAME_SH',
        'NAME_FL',
        'ADDRESS',
        'BANK_ACC',
        'DISCOUNT',
        'BOSS_SURN',
        'BOSS_NAME',
        'BOSS_OTHNAME',
        'BOSS_POST',
        'BOSS_PHONE',
        'BOSS_CELL',
        'BOSS_EMAIL',
        'BOSS_FAX',
        'ACC_SURN',
        'ACC_NAME',
        'ACC_OTHNAME',
        'ACC_POST',
        'ACC_PHONE',
        'ACC_CELL',
        'ACC_EMAIL',
        'ACC_FAX',
        'STATUS_CL',
        'CREATED_BY',
        'MODIFIED_BY',
    ];

    /**
     * @return HasMany
     */
    public function contracts(): HasMany
    {
        return $this->hasMany(Contract::class, 'client_rid', 'rid');
    }
}
