package com.neusoft.smart.pos.printer.controller;

import com.neusoft.smart.pos.dto.printer.response.GetPrinterRulesResponse;
import com.neusoft.smart.pos.dto.printer.response.GetPrinterTemplatesResponse;
import com.neusoft.smart.pos.framework.dto.ResponseData;
import com.neusoft.smart.pos.printer.service.PrinterRuleService;
import com.neusoft.smart.pos.printer.service.PrinterTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "打印字典管理使用rest接口", description = "打印字典管理使用rest接口")
@RestController
@RequestMapping(path = "/printerDictionary")
@Validated
public class PrinterDictionaryController {
    
    @Autowired
    private PrinterTemplateService printerTemplateService;
    
    @Autowired
    private PrinterRuleService printerRuleService;
    
    @ApiOperation(value = "打印模板字典列表查询使用接口", notes = "打印模板字典列表查询使用方法")
    @GetMapping("/printerTemplates")
    public ResponseData<GetPrinterTemplatesResponse> queryPrinterTemplates(
            @RequestParam(value="isEnable",defaultValue = "1") String isEnable
            ,@RequestParam(value="templateType",defaultValue = "") String templateType) {
        return new ResponseData<>(printerTemplateService.queryPrinterTemplates(isEnable,templateType));
    }
    
    @ApiOperation(value = "打印规则字典列表查询使用接口", notes = "打印规则字典列表查询使用方法")
    @GetMapping("/printerRules")
    public ResponseData<GetPrinterRulesResponse> queryPrinterRules(
            @RequestParam(value="isEnable",defaultValue = "1") String isEnable) {
        return new ResponseData<>(printerRuleService.queryPrinterRules(isEnable));
    }
}
	