package com.jeesharp.business.modules.mall.controller;

import com.jeesharp.business.modules.mall.application.MallAddPurchaseApplicationService;
import com.jeesharp.business.modules.mall.entity.MallAddPurchase;
import com.jeesharp.framework.pojo.AjaxResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 加价购移动端 Controller
 */
@RestController
@RequestMapping(value = "${jeesharp.web.adminPath}/mall/addPurchase/v1")
@Tag(name = "加价购")
@AllArgsConstructor
public class MallAddPurchaseMobileController {

    private final MallAddPurchaseApplicationService addPurchaseApplicationService;

    @Operation(summary = "获取SKU的可加价购选项")
    @PostMapping(value = "options")
    public AjaxResult<List<MallAddPurchase>> getOptions(@RequestParam("mainSkuId") String mainSkuId) {
        List<MallAddPurchase> options = addPurchaseApplicationService.getAddPurchaseOptions(mainSkuId);
        return AjaxResult.okData(options);
    }
}