package com.kym.miniapp.controller;

import com.kym.common.R;
import com.kym.entity.miniapp.queryParams.ApplyInvoiceParams;
import com.kym.service.miniapp.InvoiceService;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/invoice")
public class InvoiceController {

    private final InvoiceService invoiceService;

    public InvoiceController(InvoiceService invoiceService) {
        this.invoiceService = invoiceService;
    }

    @PostMapping("/applyInvoice")
    R<?> applyInvoice(@RequestBody ApplyInvoiceParams params) {
        return R.success(invoiceService.applyInvoice(params));
    }

    @GetMapping("/list")
    R<?> listInvoiceForApp(@RequestParam(value = "status", required = false) Integer status) {
        return R.success(invoiceService.listInvoiceForApp(status));
    }

    @GetMapping("/downloadInvoice/{invoiceId}")
    R<?> downloadInvoice(@PathVariable("invoiceId") String invoiceId) {
        return R.success();
    }

}
