package org.agt.module.system.api.mail;

import jakarta.annotation.Resource;
import org.agt.framework.common.pojo.CommonResult;
import org.agt.framework.common.util.object.BeanUtils;
import org.agt.module.system.api.mail.dto.MailTemplateSaveReqDTO;
import org.agt.module.system.controller.admin.mail.vo.template.MailTemplateSaveReqVO;
import org.agt.module.system.service.mail.MailTemplateService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

import static org.agt.framework.common.pojo.CommonResult.success;

@RestController // 提供 RESTful API 接口，给 Feign 调用
@Validated
public class MailTemplateApiImpl implements MailTemplateApi {

    @Resource
    private MailTemplateService mailTemplateService;

    @Override
    public CommonResult<Boolean> updateMailTemplate(MailTemplateSaveReqDTO reqDTO) {
        MailTemplateSaveReqVO reqVO = BeanUtils.toBean(reqDTO, MailTemplateSaveReqVO.class);
        mailTemplateService.updateMailTemplate(reqVO);
        return success(true);
    }

}
