package com.red.circle.console.adapter.app.sys;


import com.red.circle.console.app.service.app.sys.SysMessageCopywritingContentService;
import com.red.circle.framework.core.dto.CommonCommand;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.dto.sys.SysMessageCopywritingContentDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 系统推送文案类容 前端控制器
 * </p>
 *
 * @author pengliang
 * @since 2020-03-05
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/sys/push/text/content", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class SysPushTextContentRestController extends BaseController {

  private final SysMessageCopywritingContentService sysPushTextContentService;

  /**
   * 推送文案库分页列表.
   */
  @GetMapping("/{textTypeId}")
  public List<SysMessageCopywritingContentDTO> listContent(
      @PathVariable("textTypeId") Long textTypeId) {
    return sysPushTextContentService.listByTextTypeId(textTypeId);
  }

  /**
   * 一键同步翻译.
   */
  @GetMapping("/synchronize")
  public void synchronizeTemplateMessage(CommonCommand cmd) {
    sysPushTextContentService.synchronizeTemplateMessage(cmd);
  }
}
