package com.aircraft.modules.system.controller;

import com.aircraft.annotation.rest.AnonymousPostMapping;
import com.aircraft.modules.system.domain.vo.KeyValueEntity;
import com.aircraft.modules.system.service.KeyValueEntityService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 数据下拉管理控制层
 *
 * @author chenxiky
 * @version 1.0.0
 * @since 2025/7/27
 */
@RestController
@RequestMapping("/api/dataDropdown")
@Api(tags = "数据下拉管理")
public class KeyValueEntityController {

    @Resource
    private KeyValueEntityService keyValueEntityService;


    @ApiOperation(value = "获取用户名称下拉-根据不同类型获取")
    @GetMapping("/obtainUserListByType/{userType}")
    public ResponseEntity<List<KeyValueEntity>> obtainUserListByType(
            @ApiParam(value = "用户类型(后台用户=0，飞行端用户=1，客户端用户=2)", required = true, example = "0")
            @PathVariable Integer userType) {
        List<KeyValueEntity> keyValueEntityList = keyValueEntityService.obtainUserListByType(userType);
        return ResponseEntity.ok(keyValueEntityList);
    }

    /**
     * 获取景区下拉值
     */
    @ApiOperation(value = "获取景区下拉值")
    @GetMapping("/obtainScenicList")
    public ResponseEntity<List<KeyValueEntity>> obtainScenicList() {
        List<KeyValueEntity> keyValueEntityList = keyValueEntityService.obtainScenicList();
        return ResponseEntity.ok(keyValueEntityList);
    }

    /**
     * 获取设备下拉列表
     */
    @ApiOperation(value = "获取设备下拉列表")
    @GetMapping("/obtainDeviceList")
    public ResponseEntity<List<KeyValueEntity>> obtainDeviceList(@ApiParam(value = "景区ID") @RequestParam(value = "attractionId",required = false)Long attractionId) {
        List<KeyValueEntity> keyValueEntityList = keyValueEntityService.obtainDeviceList(attractionId);
        return ResponseEntity.ok(keyValueEntityList);
    }

    /**
     * 获取所有线路下拉列表
     */
    @ApiOperation(value = "获取所有线路下拉列表")
    @GetMapping("/obtainAllRouteList")
    public ResponseEntity<List<KeyValueEntity>> obtainAllRoutes() {
        List<KeyValueEntity> keyValueEntityList = keyValueEntityService.obtainAllRoutes();
        return ResponseEntity.ok(keyValueEntityList);
    }

    /**
     * 根据景区获取对应的线路下拉列表
     */
    @ApiOperation(value = "根据景区获取对应的线路下拉列表")
    @GetMapping("/obtainRouteListByScenicId/{scenicId}")
    public ResponseEntity<List<KeyValueEntity>> obtainRouteListByScenicId(
            @ApiParam(value = "景区id", required = true, example = "1")
            @PathVariable Long scenicId) {
        List<KeyValueEntity> keyValueEntityList = keyValueEntityService.obtainRouteListByScenicId(scenicId);
        return ResponseEntity.ok(keyValueEntityList);
    }

}
