package jnpf.cultivate;

import jnpf.base.ActionResult;
import jnpf.cultivate.fallback.V2CultivateOldDealApiFallback;
import jnpf.util.NoDataSourceBind;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "jnpf-ftb", fallbackFactory = V2CultivateOldDealApiFallback.class, path = "/v2/cultivate/old")
public interface V2CultivateOldDealApi {

    /**
     * 课程心得评论旧数据处理
     *
     * @param tenantId 租户ID
     * @return 响应
     */
    @NoDataSourceBind
    @GetMapping("/gained/comment")
    ActionResult<Boolean> dealOldData(@RequestParam("tenantId") String tenantId);

    @NoDataSourceBind
    @GetMapping("/identify/deal-old")
    ActionResult<Boolean> identifyDealOldData(@RequestParam("tenantId") String tenantId);

    /**
     * 迁移旧培训任务数据到新的任务日志表
     *
     * @param tenantId 租户ID
     * @return 响应
     */
    @NoDataSourceBind
    @GetMapping("/task/old-data")
    ActionResult<String> migrateOldTaskData(@RequestParam("tenantId") String tenantId);

    /**
     * 旧晋升通道成员数据迁移接口
     * 将 ftb_cultivate_promotion_member_new 表中的用户数据迁移到
     * ftb_cultivate_promotion_user 和 ftb_cultivate_promotion_setting 表中
     * 同时校验用户是否为正常状态（enabledMark = 1）
     *
     * @param tenantId 租户ID
     * @param promotionId 晋升通道ID（可选，如果传入则只迁移指定通道的数据）
     * @return 响应结果
     */
    @NoDataSourceBind
    @GetMapping("/promotion/migrate-old-data")
    ActionResult<String> migratePromotionOldData(@RequestParam("tenantId") String tenantId,
                                                  @RequestParam(value = "promotionId", required = false) String promotionId);
}
