package com.jwipc.inquiry.controller;

import com.jwipc.api.dto.ApiResult;
import com.jwipc.inquiry.dto.ShareProjectApplyApiDTO;
import com.jwipc.inquiry.logic.PurchaseApplyBillApiLogic;
import com.jwipc.log.annotation.ApiOperateLog;
import com.jwipc.log.constant.ApiDirection;
import com.jwipc.log.constant.ThirdSysType;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;

/**
 * @author 陈天仕
 * @since 2025/12/1 15:00
 */
@RestController
@RequestMapping( "/share/api/purchase/apply")
@RequiredArgsConstructor
@Validated
public class SharePurchaseApplyBillApiController {
    private final PurchaseApplyBillApiLogic purchaseApplyBillApiLogic;

    /**
     * 共享采购申请数据同步SRM
     * @param param 参数
     */
    @PostMapping("/sync")
    @ApiOperateLog(code = "purchaseApplySync",name = "共享采购申请数据同步SRM", direction = ApiDirection.OTHER_TO_SRM, thirdSysType = ThirdSysType.SHARE)
    public ApiResult sync(@Valid @RequestBody ShareProjectApplyApiDTO param){
        return purchaseApplyBillApiLogic.saveFromShare(param);
    }
}
