package org.dromara.mall.product.controller.app;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.mall.product.domain.vo.MallCategoryVo;
import org.dromara.mall.product.service.MallCategoryService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品分类（移动端）
 *
 * @author pengles
 */
@Tag(name = "移动端-商品分类", description = "商品分类查询接口")
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/mall/product/category")
public class AppMallCategoryController {

    private final MallCategoryService mallCategoryService;

    /**
     * 查询商品分类树形列表（移动端）
     */
    @Operation(summary = "查询商品分类树形列表", description = "查询启用的商品分类树形结构")
    @GetMapping("/tree")
    public R<List<MallCategoryVo>> tree() {
        List<MallCategoryVo> list = mallCategoryService.queryTreeList();
        return R.ok(list);
    }
}
