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;
018import java.util.List;
019
020@Schema(name = "MatchedRoutes", description = "Defines a collection of routes that were selected to service a request")
021public class MatchedRoutesJson<T extends BaseRouteJson<?>> implements IModelJson {
022
023        @JsonProperty("matchedRoutes")
024        @Schema(description = "This is a collection of routes that were selected to service the request")
025        private final List<T> myRoutes = new ArrayList<>();
026
027        public MatchedRoutesJson(Collection<T> theRoutes) {
028                myRoutes.addAll(theRoutes);
029        }
030
031        public MatchedRoutesJson() {}
032
033        public List<T> getSelectedRoutes() {
034                return myRoutes;
035        }
036
037        public void addRoute(T theRoute) {
038                myRoutes.add(theRoute);
039        }
040
041        public void removeRoute(T theRoute) {
042                myRoutes.remove(theRoute);
043        }
044}