<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class SupplierChannelModel extends Model
{
    protected $connection = 'web';
    protected $table = 'supplier_channel';
    public $timestamps = false;

    //待复审(第一次新增)
    const STATUS_NEED_REVIEW = -1;
    //待提审
    const STATUS_PENDING = 0;
    //审核中
    const STATUS_IN_REVIEW = 1;
    //通过
    const STATUS_PASSED = 2;
    //未通过
    const STATUS_REJECT = 3;
    //禁止交易(禁用)
    const STATUS_DISABLE = -2;
    //黑名单
    const STATUS_BLOCK = -3;

    const SUPPLIER_TYPE_OFFICIAL = 1;
    const SUPPLIER_TYPE_TEMPORARY = 2;

    //一体化同步状态,失败,未同步,成功
    const SYNC_UNITED_STATUS_FAIL = -1;
    const SYNC_UNITED_STATUS_NOT_SYNC = 0;
    const SYNC_UNITED_STATUS_OK = 1;

    //供应商类型
    const SUPPLIER_GROUP_PROXY = 1; //代理
    const SUPPLIER_GROUP_ORIGINAL = 4; //原厂
    const SUPPLIER_GROUP_MIX = 7; //混合分销商

    //供应商地区
    const REGION_CN = 2; //国内

    //有上传过SKU
    const HAS_UPLOADED_SKU = 1;

    //是否是实体名单
    const IS_ENTITY_NEED_CONFIRM = 0; //待确认
    const IS_ENTITY_TRUE = 1; //是
    const IS_ENTITY_FALSE = -1; //否
    const IS_ENTITY_REJECT = -2; //驳回


    //黑名单信息
    public function blacklist()
    {
        return $this->hasOne(SupplierBlacklistModel::class, 'supplier_id', 'supplier_id');
    }

    //联系方式列表
    public function contact()
    {
        return $this->hasMany(SupplierContactModel::class, 'supplier_id', 'supplier_id');
    }

    //附件
    public function attachment()
    {
        return $this->hasMany(SupplierAttachmentsModel::class, 'supplier_id', 'supplier_id');
    }

    //交易方式
    public function pay_type()
    {
        return $this->hasMany(SupplierPayTypeModel::class, 'supplier_id', 'supplier_id');
    }

    //银行信息
    public function receipt()
    {
        return $this->hasMany(SupplierReceiptModel::class, 'supplier_id', 'supplier_id');
    }

}