package cn.stylefeng.team.portal.modular.front.controller;

import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import cn.stylefeng.team.portal.modular.front.pojo.request.CommonComponentRequest;
import cn.stylefeng.team.portal.modular.front.pojo.request.CommonSummaryRequest;
import cn.stylefeng.team.portal.modular.front.pojo.response.FrontAppLinkItem;
import cn.stylefeng.team.portal.modular.front.service.ComponentAppLinkService;
import cn.stylefeng.team.portal.modular.management.entity.PortalAppLinkCategory;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@ApiResource(name = "应用链接组件")
public class ComponentAppLinkController {

    @Resource
    private ComponentAppLinkService componentAppLinkService;

    @GetResource(name = "获取所有应用链接分类", path = "/component/appLink/getCategoryList")
    public ResponseData<List<PortalAppLinkCategory>> getCategoryList(@Validated(CommonComponentRequest.list.class) CommonComponentRequest slideshowSelectListRequest) {
        List<PortalAppLinkCategory> list = componentAppLinkService.getCategoryList(slideshowSelectListRequest);
        return new SuccessResponseData<>(list);
    }

    @PostResource(name = "获取应用分类+应用连接", path = "/component/appLink/summary")
    public ResponseData<List<FrontAppLinkItem>> summary(@RequestBody @Validated CommonSummaryRequest commonSummaryRequest) {
        List<FrontAppLinkItem> list = componentAppLinkService.getAppLinkSummary(commonSummaryRequest);
        return new SuccessResponseData<>(list);
    }

}
