<?php

namespace app\common\model;

use support\think\Model;

/**
 * MallItem
 * type: 1=BONUS(红利), 2=PHYSICAL(实物), 3=WITHDRAW(提现档位)
 *
 * @property string $title
 * @property string $description
 * @property string $title_en
 * @property string|null $description_en
 * @property string $title_ms
 * @property string|null $description_ms
 */
class MallItem extends Model
{
    protected $name = 'mall_item';

    protected bool $autoWriteTimestamp = true;

    public const TYPE_BONUS = 1;
    public const TYPE_PHYSICAL = 2;
    public const TYPE_WITHDRAW = 3;

    protected array $type = [
        'create_time' => 'integer',
        'update_time' => 'integer',
        'amount'      => 'float',
        'multiplier'  => 'integer',
    ];

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