// Path: src/main/java/guru/springframework/hl7/exceptions/InvalidHL7MessageException.java
// public class InvalidHL7MessageException extends Exception {
//     public InvalidHL7MessageException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/guru/springframework/hl7/exceptions/UnhandledHL7MessageException.java
// public class UnhandledHL7MessageException extends Exception {
//     public UnhandledHL7MessageException(String message)
//     {
//         super(message);
//     }
// }


import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.GenericMessage;
import ca.uhn.hl7v2.parser.GenericModelClassFactory;
import guru.springframework.hl7.exceptions.InvalidHL7MessageException;
import guru.springframework.hl7.exceptions.UnhandledHL7MessageException;
import org.springframework.stereotype.Component;
            switch (messageVersion)
            {
                case "2.1":
                    routingChannel = HL7V21_INBOUND_CHANNEL;
                    break;
                case "2.2":
                    routingChannel = "hl7v22InboundChannel";
                    break;
                case "2.3":
                    routingChannel = "hl7v23InboundChannel";
                    break;
                case "2.4":
                    routingChannel = "hl7v24InboundChannel";
                    break;
                case "2.5":
                    routingChannel = "hl7v25InboundChannel";
                    break;
                case "2.6":
                    routingChannel = "hl7v26InboundChannel";
                    break;
                default:
                    System.out.println("Unhandled Message Received");
                    throw new UnhandledHL7MessageException(String.format("Unhandled Message Received: %s", messageVersion));
            }



        } catch (HL7Exception ex) {
            System.out.println(ex.getMessage());
            System.out.println(ex.getStackTrace());
// Path: src/main/java/guru/springframework/hl7/exceptions/InvalidHL7MessageException.java
// public class InvalidHL7MessageException extends Exception {
//     public InvalidHL7MessageException(String message) {
//         super(message);
//     }
// }
// 
// Path: src/main/java/guru/springframework/hl7/exceptions/UnhandledHL7MessageException.java
// public class UnhandledHL7MessageException extends Exception {
//     public UnhandledHL7MessageException(String message)
//     {
//         super(message);
//     }
// }


// Path: src/main/java/guru/springframework/hl7/routers/HL7VersionRouter.java
import ca.uhn.hl7v2.DefaultHapiContext;
import ca.uhn.hl7v2.HL7Exception;
import ca.uhn.hl7v2.model.GenericMessage;
import ca.uhn.hl7v2.parser.GenericModelClassFactory;
import guru.springframework.hl7.exceptions.InvalidHL7MessageException;
import guru.springframework.hl7.exceptions.UnhandledHL7MessageException;
import org.springframework.stereotype.Component;

            switch (messageVersion)
            {
                case "2.1":
                    routingChannel = HL7V21_INBOUND_CHANNEL;
                    break;
                case "2.2":
                    routingChannel = "hl7v22InboundChannel";
                    break;
                case "2.3":
                    routingChannel = "hl7v23InboundChannel";
                    break;
                case "2.4":
                    routingChannel = "hl7v24InboundChannel";
                    break;
                case "2.5":
                    routingChannel = "hl7v25InboundChannel";
                    break;
                case "2.6":
                    routingChannel = "hl7v26InboundChannel";
                    break;
                default:
                    System.out.println("Unhandled Message Received");
                    throw new UnhandledHL7MessageException(String.format("Unhandled Message Received: %s", messageVersion));
            }



        } catch (HL7Exception ex) {
            System.out.println(ex.getMessage());
            System.out.println(ex.getStackTrace());
            throw new InvalidHL7MessageException("Invalid Message Received");