package thyyxxk.webserver.controller.zhuyuanyiji;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import thyyxxk.webserver.entity.ResultVo;
import thyyxxk.webserver.entity.medicaltechnology.AsidePage;
import thyyxxk.webserver.entity.medicaltechnology.FetchMedicines;
import thyyxxk.webserver.entity.medicaltechnology.MedicinePage;
import thyyxxk.webserver.entity.medicaltechnology.PoisonousAnesthetics;
import thyyxxk.webserver.service.zhuyuanyiji.MedicineManagementService;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/medicineManagement")
public class MedicineManagementController {
    private final MedicineManagementService service;

    @Autowired
    public MedicineManagementController(MedicineManagementService service) {
        this.service = service;
    }

    @PostMapping("/fetchMedicinePages")
    public ResultVo<List<MedicinePage>> fetchMedicinePages(@RequestBody @Validated FetchMedicines params) {
        return service.fetchMedicinePages(params);
    }

    @PostMapping("/submitMedicinePages")
    public ResultVo<List<MedicinePage>> submitMedicinePages(@RequestBody @Validated FetchMedicines params) {
        return service.submitMedicinePages(params);
    }

    @PostMapping("/fetchUsedMedicines")
    public ResultVo<List<MedicinePage>> fetchUsedMedicines(@RequestBody @Validated FetchMedicines params) {
        return service.fetchUsedMedicines(params);
    }

    @PostMapping("/fetchPoisonousAnesthetics")
    public ResultVo<Map<String, Object>> fetchPoisonousAnesthetics(@RequestBody @Validated FetchMedicines params) {
        return service.fetchPoisonousAnesthetics(params);
    }

    @PostMapping("/fetchSubmittedPageNos")
    public ResultVo<List<AsidePage>> fetchSubmittedPageNos(@RequestBody @Validated FetchMedicines params) {
        return service.fetchSubmittedPageNos(params);
    }

    @PostMapping("/fetchMedicinePageDetail")
    public ResultVo<List<MedicinePage>> fetchMedicinePageDetail(@RequestBody AsidePage params) {
        return service.fetchMedicinePageDetail(params);
    }
}
