package com.xueyi.system.digitalmans.controller;

import com.xueyi.common.core.web.result.AjaxResult;
import com.xueyi.common.core.web.validate.V_A;
import com.xueyi.common.core.web.validate.V_E;
import com.xueyi.common.log.annotation.Log;
import com.xueyi.common.log.enums.BusinessType;
import com.xueyi.common.security.annotation.Logical;
import com.xueyi.common.security.annotation.RequiresPermissions;
import com.xueyi.common.web.entity.controller.BaseController;
import com.xueyi.system.api.digitalmans.domain.dto.DmScreenIconDto;
import com.xueyi.system.digitalmans.domain.query.DmScreenIconQuery;
import com.xueyi.system.digitalmans.service.IDmScreenIconService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;

/**
 * 数字人主界面图标管理 业务处理
 *
 * @author xueyi
 */
@RestController
@RequestMapping("/screenIcon")
public class DmScreenIconController extends BaseController<DmScreenIconQuery, DmScreenIconDto, IDmScreenIconService> {

    /** 定义节点名称 */
    @Override
    protected String getNodeName() {
        return "数字人主界面图标" ;
    }

    /**
     * 查询数字人主界面图标列表
     */
    @Override
    @GetMapping("/list")
    @RequiresPermissions(Auth.DM_SCREEN_ICON_LIST)
    public AjaxResult list(DmScreenIconQuery screenIcon) {
        return super.list(screenIcon);
    }

    /**
     * 查询数字人主界面图标详细
     */
    @Override
    @GetMapping(value = "/{id}")
    @RequiresPermissions(Auth.DM_SCREEN_ICON_SINGLE)
    public AjaxResult getInfo(@PathVariable Serializable id) {
        return super.getInfo(id);
    }

    /**
     * 数字人主界面图标新增
     */
    @Override
    @PostMapping
    @RequiresPermissions(Auth.DM_SCREEN_ICON_ADD)
    @Log(title = "数字人主界面图标管理", businessType = BusinessType.INSERT)
    public AjaxResult add(@Validated({V_A.class}) @RequestBody DmScreenIconDto screenIcon) {
        return super.add(screenIcon);
    }

    /**
     * 数字人主界面图标修改
     */
    @Override
    @PutMapping
    @RequiresPermissions(Auth.DM_SCREEN_ICON_EDIT)
    @Log(title = "数字人主界面图标管理", businessType = BusinessType.UPDATE)
    public AjaxResult edit(@Validated({V_E.class}) @RequestBody DmScreenIconDto screenIcon) {
        return super.edit(screenIcon);
    }

    /**
     * 数字人主界面图标修改状态
     */
    @Override
    @PutMapping("/status")
    @RequiresPermissions(value = {Auth.DM_SCREEN_ICON_EDIT, Auth.DM_SCREEN_ICON_ES}, logical = Logical.OR)
    @Log(title = "数字人主界面图标管理", businessType = BusinessType.UPDATE_STATUS)
    public AjaxResult editStatus(@RequestBody DmScreenIconDto screenIcon) {
        return super.editStatus(screenIcon);
    }

    /**
     * 数字人主界面图标批量删除
     */
    @Override
    @DeleteMapping("/batch/{idList}")
    @RequiresPermissions(Auth.DM_SCREEN_ICON_DEL)
    @Log(title = "数字人主界面图标管理", businessType = BusinessType.DELETE)
    public AjaxResult batchRemove(@PathVariable List<Long> idList) {
        return super.batchRemove(idList);
    }

    /**
     * 获取数字人主界面图标选择框列表
     */
    @Override
    @GetMapping("/option")
    public AjaxResult option() {
        return super.option();
    }

    interface Auth {
        /** 系统 - 数字人主界面图标管理 - 列表 */
        String DM_SCREEN_ICON_LIST = "digitalmans:screenIcon:list";
        /** 系统 - 数字人主界面图标管理 - 详情 */
        String DM_SCREEN_ICON_SINGLE = "digitalmans:screenIcon:single";
        /** 系统 - 数字人主界面图标管理 - 新增 */
        String DM_SCREEN_ICON_ADD = "digitalmans:screenIcon:add";
        /** 系统 - 数字人主界面图标管理 - 修改 */
        String DM_SCREEN_ICON_EDIT = "digitalmans:screenIcon:edit";
        /** 系统 - 数字人主界面图标管理 - 修改状态 */
        String DM_SCREEN_ICON_ES = "digitalmans:screenIcon:es";
        /** 系统 - 数字人主界面图标管理 - 删除 */
        String DM_SCREEN_ICON_DEL = "digitalmans:screenIcon:delete";
    }
}
