package com.sqx.modules.errand.controller.app;

import com.sqx.common.query.PageQuery;
import com.sqx.common.utils.Constant;
import com.sqx.common.utils.PageUtils;
import com.sqx.common.utils.Result;
import com.sqx.modules.errand.dto.SmsTemplateQueryDTO;
import com.sqx.modules.errand.service.TbIndentSmsTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("app/tb-indent-sms")
@Api(value = "骑手端-跑腿确认送达短信", tags = {"骑手端-跑腿确认送达短信"})
@RequiredArgsConstructor
public class AppTbIndentSmsController {

    private final TbIndentSmsTemplateService smsTemplateService;

    @ApiOperation("模板分页")
    @GetMapping(value = "template")
    public Result templatePage(PageQuery pageQuery) {
        SmsTemplateQueryDTO queryDTO = new SmsTemplateQueryDTO();
        BeanUtils.copyProperties(pageQuery, queryDTO);
        queryDTO.setStatus(Constant.YES);
        PageUtils pageUtils = smsTemplateService.templatePage(queryDTO);
        return Result.success().put("data", pageUtils);
    }
}
