package org.example.service;

import org.example.model.TransactionRequest;
import org.example.model.TransactionResponse;
import org.springframework.stereotype.Component;

@Component
public class TransactionRulesService {

    public TransactionResponse evaluateTransaction(TransactionRequest request) {
        TransactionResponse response = new TransactionResponse();
        response.setServiceRefId("REF-20260419-ABC123");
        response.setDecision("ALLOW");
        response.setCode("RULE_PASSED");
        response.setMessage("Transaction approved by rules engine");

        TransactionResponse.Amount amount = new TransactionResponse.Amount();
        amount.setValue("000000015000");
        amount.setCurrency("840");
        response.setAmount(amount);

        TransactionResponse.Header header = new TransactionResponse.Header();
        header.setMerchantName("Demo Merchant LLC");
        header.setMerchantAddress("123 Main St, Colombo");
        header.setLogo("https://cdn.example.com/logo.png");
        response.setHeader(header);

        TransactionResponse.Footer footer = new TransactionResponse.Footer();
        footer.setDescription("Thank you for shopping");
        footer.setLogo("https://cdn.example.com/footer-logo.png");
        footer.setMessage("Powered by DataAegis");
        response.setFooter(footer);

        response.setProviderTime("2026-04-19T10:30:01.123Z");
        response.setModelName("true");

        return response;
    }
}
