001/*-
002 * #%L
003 * Smile CDR - CDR
004 * %%
005 * Copyright (C) 2016 - 2024 Smile CDR, Inc.
006 * %%
007 * All rights reserved.
008 * #L%
009 */
010package ca.cdr.api.fhirgw.json;
011
012import ca.cdr.api.model.json.IModelJson;
013import com.fasterxml.jackson.annotation.JsonProperty;
014import io.swagger.v3.oas.annotations.media.Schema;
015
016import java.util.ArrayList;
017import java.util.Collection;
018
019@Schema(name = "MatchedRoutes", description = "Defines a collection of routes that were selected to service a request")
020public class MatchedRoutesJson<T extends BaseRouteJson<?>> implements IModelJson {
021
022        @JsonProperty("matchedRoutes")
023        @Schema(description = "This is a collection of routes that were selected to service the request")
024        private final ArrayList<T> myRoutes = new ArrayList<>();
025
026        public MatchedRoutesJson(Collection<T> theRoutes) {
027                myRoutes.addAll(theRoutes);
028        }
029
030        public MatchedRoutesJson() {}
031
032        public ArrayList<T> getSelectedRoutes() {
033                return myRoutes;
034        }
035
036        public void addRoute(T theRoute) {
037                myRoutes.add(theRoute);
038        }
039
040        public void removeRoute(T theRoute) {
041                myRoutes.remove(theRoute);
042        }
043}