001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.bean.mcp.v20260728;
018
019import static org.apache.juneau.commons.utils.CollectionUtils.*;
020import static org.apache.juneau.commons.utils.Shorts.*;
021
022import java.util.*;
023
024import org.apache.juneau.marshall.*;
025
026/**
027 * Completion values for a {@value McpMethods#COMPLETION_COMPLETE} request.
028 *
029 * <p>
030 * This is a lossless wire carrier. It does not itself enforce the protocol's 100-value cap or any other
031 * server policy; dispatch is responsible for capping, ordering, and validating values before construction.
032 */
033@Marshalled
034public class Completion {
035
036   private List<String> values;
037   private Integer total;
038   private Boolean hasMore;
039
040   /**
041    * Candidate completion values.
042    *
043    * @return The values list, or {@code null} if not set.
044    */
045   public List<String> getValues() {
046      return u(values);
047   }
048
049   /**
050    * Sets the candidate completion values.
051    *
052    * @param value The new value.  Can be <jk>null</jk> to unset the property.
053    * @return This object (for method chaining).
054    */
055   public Completion setValues(List<String> value) {
056      values = value;
057      return this;
058   }
059
060   /**
061    * Sets the candidate completion values.
062    *
063    * @param value The new value.  Can be <jk>null</jk> to unset the property.
064    * @return This object (for method chaining).
065    */
066   public Completion setValues(String...value) {
067      values = list(value);
068      return this;
069   }
070
071   /**
072    * Appends to the candidate completion values.
073    *
074    * @param value The values to append.
075    * @return This object (for method chaining).
076    */
077   public Completion addValues(String...value) {
078      if (values == null)
079         values = list();
080      Collections.addAll(values, value);
081      return this;
082   }
083
084   /**
085    * Appends to the candidate completion values.
086    *
087    * @param value The values to append.
088    * @return This object (for method chaining).
089    */
090   public Completion addValues(Collection<String> value) {
091      if (values == null)
092         values = list();
093      values.addAll(value);
094      return this;
095   }
096
097   /**
098    * Optional total number of matches, which may exceed {@link #getValues()} when truncated.
099    *
100    * @return The total, or {@code null} if not set.
101    */
102   public Integer getTotal() {
103      return total;
104   }
105
106   /**
107    * Sets the total number of matches.
108    *
109    * @param value The new value.  Can be <jk>null</jk> to unset the property.
110    * @return This object (for method chaining).
111    */
112   public Completion setTotal(Integer value) {
113      total = value;
114      return this;
115   }
116
117   /**
118    * Optional flag indicating additional values exist beyond {@link #getValues()}.
119    *
120    * @return The flag, or {@code null} if not set.
121    */
122   public Boolean getHasMore() {
123      return hasMore;
124   }
125
126   /**
127    * Sets the has-more flag.
128    *
129    * @param value The new value.  Can be <jk>null</jk> to unset the property.
130    * @return This object (for method chaining).
131    */
132   public Completion setHasMore(Boolean value) {
133      hasMore = value;
134      return this;
135   }
136}