package co.yixiang.yshop.module.order.controller.app;

import co.yixiang.yshop.framework.common.pojo.CommonResult;
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
import co.yixiang.yshop.module.distributor.api.dto.DistributorOrderDTO;
import co.yixiang.yshop.module.order.service.storeorder.AppDistributorOrderFacade;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.annotation.security.PermitAll;

import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;

@Slf4j
@RestController
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
@Tag(name = "用户 APP - 订单模块")
@RequestMapping("/test")
public class TestOrderController {

    @Resource
    private AppDistributorOrderFacade appDistributorOrderFacade;

    @PermitAll
    @PostMapping("/save")
    public CommonResult<Boolean> save() {
        appDistributorOrderFacade.createDistributorOrder(new DistributorOrderDTO().setOid(91L).setDistributorId(1L).setUserId(17L));
        return success(Boolean.TRUE);

    }
}
