package com.cool.store.controller.webc;

import com.cool.store.response.ResponseResult;
import com.cool.store.service.store.StoreTypeService;
import com.cool.store.vo.store.StoreTypeOptionVO;
import com.cool.store.vo.store.StoreTypeVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Auther zx_szh
 * @Date 2026/1/27 13:44
 * @Version 1.0
 */
@Api(tags = "小程序-店型")
@RestController
@RequestMapping("/mini/storeType")
@RequiredArgsConstructor
public class MiniStoreTypeController {

    private final StoreTypeService storeTypeService;
    @ApiOperation("通过门店类型查询该类型下的店型")
    @GetMapping("/listByStoreType")
    public ResponseResult<List<StoreTypeVO>> listStoreTypesByStoreType(@RequestParam("storeType") Integer storeType) {
        return ResponseResult.success(storeTypeService.listActiveByStoreType(storeType));
    }

    @ApiOperation("查询店型的详细配置选项")
    @GetMapping("/config/detail")
    public ResponseResult<List<StoreTypeOptionVO>> storeTypeConfigDetail(@RequestParam("storeTypeId") Long storeTypeId) {
        return ResponseResult.success(storeTypeService.listStoreTypeOptions(storeTypeId));
    }
}
