package com.fzm.mall.server.admin.message.controller;

import com.fzm.mall.server.admin.home_page.enums.type.AdminTypeEnum;
import com.fzm.mall.server.admin.home_page.service.IAdminService;
import com.fzm.mall.server.admin.message.entity.dto.SmsSendDTO;
import com.fzm.mall.server.admin.message.service.ISmsSendService;
import com.fzm.mall.server.admin.repo.ResponseFactory;
import com.fzm.mall.server.admin.repo.ResponseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author wangp
 * @date 2021/4/29 15:53
 * @description 发送短信
 * @since JDK 1.8
 */
@Api(tags = "消息中心-发送短信")
@RestController
@RequestMapping("/smsSend")
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class SmsSendController {
    private final IAdminService adminService;
    private final ISmsSendService smsSendService;
    private final ResponseFactory resFac;

    @ApiOperation(value = "发送")
//    @AdminLog(description = "财务中心-新增商户收付款方式", module = OperateModuleEnum.FINANCE_CENTER)
    @PostMapping("/send")
    public ResponseVO<String> send(@RequestBody SmsSendDTO dto, @RequestHeader String adminId) {
        adminService.adminAuthChecks(adminId, AdminTypeEnum.getMerchantTypeArr());
        smsSendService.send(dto);
        return resFac.getSimpleSuccessResponse();
    }
}