package cn.ysk.cashier.controller.shop;

import cn.ysk.cashier.annotation.rest.AnonymousPostMapping;
import cn.ysk.cashier.dto.BindingDto;
import cn.ysk.cashier.service.BindService;
import cn.ysk.cashier.service.shop.TbShopInfoService;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

/**
 * @author Administrator
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/api/invoice")
public class ShopInvoiceController {

    @Resource
    private TbShopInfoService shopInfoService;
    @Resource
    private BindService bindService;

    @PostMapping("binding")
    @ApiOperation("绑定开票信息")
    public ResponseEntity<Object> binding(@Validated @RequestBody BindingDto bindingDto){
        return new ResponseEntity<>(shopInfoService.binding(bindingDto), HttpStatus.OK);
    }

    @PostMapping("subInvoicing")
    @ApiOperation("提交开票")
    public ResponseEntity<Object> subInvoicing(@RequestBody Map<String, Object> params){
        return new ResponseEntity<>(bindService.subInvoicing(params), HttpStatus.OK);
    }

    @PostMapping("industry")
    @ApiOperation("获取项目分类")
    @AnonymousPostMapping("industry")
    public ResponseEntity<Object> industry(@RequestBody BindingDto bindingDto){
        return new ResponseEntity<>(bindService.industry(bindingDto), HttpStatus.OK);
    }

    @PostMapping("digitalInvoice")
    @ApiOperation("数电发票类型")
    @AnonymousPostMapping("digitalInvoice")
    public ResponseEntity<Object> digitalInvoice(){
        return new ResponseEntity<>(bindService.digitalInvoice(), HttpStatus.OK);
    }

    @PostMapping("storeSe")
    @ApiOperation("计算税额")
    @AnonymousPostMapping("storeSe")
    public ResponseEntity<Object> storeSe(@RequestBody Map<String, Object> params){
        return new ResponseEntity<>(bindService.storeSe(params), HttpStatus.OK);
    }




}
