<?php

namespace app\store\controller;

use app\common\logic\SystemStoreStaffLogic;
use hg\apidoc\annotation as ApiDoc;

#[ApiDoc\title('店员管理')]
class StaffController extends BaseAdminController
{

    #[
        ApiDoc\Title('列表'),
        ApiDoc\url('/store/staff/lists'),
        ApiDoc\Method('GET'),
        ApiDoc\NotHeaders(),
        ApiDoc\Author('中国队长'),
        ApiDoc\ResponseSuccess("data", type: "array", children: [
            ['name' => 'id', 'desc' => 'id', 'type' => 'int'],
            ['name' => 'staff_name', 'desc' => '店员名称', 'type' => 'string'],
            ['name' => 'avatar', 'desc' => '头像', 'type' => 'string'],
            ['name' => 'account', 'desc' => '账号', 'type' => 'string'],
            ['name' => 'phone', 'desc' => '手机号', 'type' => 'string'],
            ['name' => 'is_admin', 'desc' => '是否是管理员', 'type' => 'string'],
            ['name' => 'is_manager', 'desc' => '是否是店长', 'type' => 'string'],
        ]),
    ]
    public function lists(SystemStoreStaffLogic $staffLogic)
    {
        return $this->data($staffLogic->listByWhere(['store_id' => $this->request->adminInfo['store_id'], 'status' => 1], 'id,staff_name,avatar,account,phone,is_admin,is_manager'));
    }

}