<?php

namespace app\common\model;

use support\think\Model;

class AgentCommissionRecord extends Model
{
    protected $name = 'agent_commission_record';

    protected $autoWriteTimestamp = true;

    protected $type = [
        'create_time' => 'integer',
        'update_time' => 'integer',
        'settled_at' => 'integer',
        'commission_rate' => 'string',
        'calc_base_amount' => 'string',
        'commission_amount' => 'string',
        'status' => 'integer',
    ];

    public function channel(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(Channel::class, 'channel_id', 'id');
    }

    public function admin(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(\app\admin\model\Admin::class, 'admin_id', 'id');
    }

    public function settlementPeriod(): \think\model\relation\BelongsTo
    {
        return $this->belongsTo(AgentSettlementPeriod::class, 'settlement_period_id', 'id');
    }
}

