<?php

namespace App\Admin\Controllers;

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

/**
 * 技师
 *
 * @property CoachUserService $service
 */
class CoachUserController extends AdminController
{
	protected string $serviceName = CoachUserService::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('qualification_record_id', '技师资质认证记录编号'),
				amis()->TableColumn('shop_id', '店铺编号'),
				amis()->TableColumn('level', '技师等级'),
				amis()->TableColumn('virtual_order', '虚拟订单数')->sortable(),
				amis()->TableColumn('score', '评分'),
				amis()->TableColumn('work_status', '工作状态'),
				amis()->TableColumn('virtual_status', '虚拟状态'),
				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('qualification_record_id', '技师资质认证记录编号'),
			amis()->TextControl('shop_id', '店铺编号'),
			amis()->TextControl('level', '技师等级'),
			amis()->TextControl('virtual_order', '虚拟订单数'),
			amis()->TextControl('score', '评分'),
			amis()->TextControl('work_status', '工作状态'),
			amis()->TextControl('virtual_status', '虚拟状态'),
			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('qualification_record_id', '技师资质认证记录编号')->static(),
			amis()->TextControl('shop_id', '店铺编号')->static(),
			amis()->TextControl('level', '技师等级')->static(),
			amis()->TextControl('virtual_order', '虚拟订单数')->static(),
			amis()->TextControl('score', '评分')->static(),
			amis()->TextControl('work_status', '工作状态')->static(),
			amis()->TextControl('virtual_status', '虚拟状态')->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(),
		]);
	}
}