package com.kapdion.omds.productdefinitions;

import at.vvo.omds.types.omds3.r2025_05.common.ProductsRequest;

import com.kapdion.omds.productdefinitions.apriori.AprioriService;
import com.kapdion.omds.productdefinitions.calculate.CalculateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.xml.datatype.DatatypeConfigurationException;
import java.io.IOException;

@Slf4j
@RestController

public class EndpointsZentralesBOA {

    @PostMapping("/ProductsRequest")
    public String apriori(@RequestBody ProductsRequest productsRequest){
        AprioriService as = new AprioriService();
        String s = as.getProductsResponse(productsRequest);
        System.out.println("-----------------------");
        System.out.println("Products request: " + s);

        return s;
    };

    @PostMapping("/CalculateRequest")
    public String calc(@RequestBody String calculateRequest) throws Exception {
        CalculateService cs = new CalculateService();
        String s = cs.buildResponse(calculateRequest);
        System.out.println("-----------------------");
        System.out.println("Calculate request: " + s);
        return s;
    };

}
