package com.fjs.scenic.controller;

import com.fjs.scenic.entity.order.Receipt;
import com.fjs.scenic.service.ord.ReceiptService;
import com.fjs.scenic.utils.ReturnResult;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/receipt")
public class ReceiptController {

    @Autowired
    private ReceiptService receiptService;

    @ApiOperation(value = "添加发票", notes = "添加发票")
    @PostMapping("/addReceipt")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "orderId", dataType = "int", value = "订单id", required = true, paramType = "query"),
            @ApiImplicitParam(name = "type", dataType = "string", value = "类型（0企业，1非企业）", required = true, paramType = "query"),
            @ApiImplicitParam(name = "head", dataType = "string", value = "发票抬头", required = false, paramType = "query"),
            @ApiImplicitParam(name = "content", dataType = "string", value = "发票内容", required = false, paramType = "query"),
            @ApiImplicitParam(name = "number", dataType = "string", value = "税号", required = false, paramType = "query"),
            @ApiImplicitParam(name = "price", dataType = "double", value = "发票金额", required = true, paramType = "query"),
            @ApiImplicitParam(name = "email", dataType = "string", value = "邮箱", required = false, paramType = "query")
    })
    public ReturnResult addReceipt(Receipt receipt){
       return receiptService.add(receipt);
    }
}
