<?php

namespace App\Admin\Controllers;

use App\Services\AgentInfoService;
use Slowlyo\OwlAdmin\Controllers\AdminController;

/**
 * 代理商
 *
 * @property AgentInfoService $service
 */
class AgentInfoController extends AdminController
{
	protected string $serviceName = AgentInfoService::class;

	public function list()
	{
		$crud = $this->baseCRUD()
			->filterTogglable(false)
			->headerToolbar([
				$this->createButton('dialog'),
				...$this->baseHeaderToolBar()
			])
			->columns([
				amis()->TableColumn('id', 'ID')->sortable(),
				amis()->TableColumn('user_id', '用户编号'),
				amis()->TableColumn('info_record_id', '代理商信息记录编号'),
				amis()->TableColumn('real_auth_record_id', '代理商实名认证记录编号'),
				amis()->TableColumn('qual_record_id', '代理商资质认证记录编号'),
				amis()->TableColumn('state', '状态'),
				amis()->TableColumn('created_at', admin_trans('admin.created_at'))->type('datetime')->sortable(),
				amis()->TableColumn('updated_at', admin_trans('admin.updated_at'))->type('datetime')->sortable(),
				$this->rowActions('dialog')
			]);

		return $this->baseList($crud);
	}

	public function form($isEdit = false)
	{
		return $this->baseForm()->body([
			amis()->TextControl('user_id', '用户编号'),
			amis()->TextControl('info_record_id', '代理商信息记录编号'),
			amis()->TextControl('real_auth_record_id', '代理商实名认证记录编号'),
			amis()->TextControl('qual_record_id', '代理商资质认证记录编号'),
			amis()->TextControl('state', '状态'),
		]);
	}

	public function detail()
	{
		return $this->baseDetail()->body([
			amis()->TextControl('id', 'ID')->static(),
			amis()->TextControl('user_id', '用户编号')->static(),
			amis()->TextControl('info_record_id', '代理商信息记录编号')->static(),
			amis()->TextControl('real_auth_record_id', '代理商实名认证记录编号')->static(),
			amis()->TextControl('qual_record_id', '代理商资质认证记录编号')->static(),
			amis()->TextControl('state', '状态')->static(),
			amis()->TextControl('created_at', admin_trans('admin.created_at'))->static(),
			amis()->TextControl('updated_at', admin_trans('admin.updated_at'))->static(),
		]);
	}
}