001package gudusoft.gsqlparser.lineage.v2.model;
002
003import java.util.Arrays;
004import java.util.Collections;
005import java.util.List;
006import java.util.Map;
007
008/**
009 * Truncation applied when the document was served (Section 4.4). It never rewrites analysis
010 * completeness, and known Facts are never dropped because the result as a whole was truncated.
011 * Generated from the schema definition ServingCompleteness by scripts/sqllr/gen_type_model.py; do
012 * not edit.
013 *
014 * @since 4.2.17
015 */
016public final class ServingCompleteness extends SqllrObject {
017
018    /** The members the schema defines, in schema order. */
019    public static final List<String> MEMBERS = Collections.unmodifiableList(Arrays.asList("status", "truncations", "extensions"));
020
021    /** The members the schema requires. */
022    public static final List<String> REQUIRED = Collections.unmodifiableList(Arrays.<String>asList("status"));
023
024    /** Reads a JSON object as a {@code ServingCompleteness}. */
025    public static final Reader<ServingCompleteness> READER = new Reader<ServingCompleteness>() {
026        @Override
027        public ServingCompleteness read(Object json) {
028            return fromJson(json);
029        }
030    };
031
032    private ServingCompleteness(Map<String, Object> members) {
033        super(members);
034    }
035
036    /** A {@code ServingCompleteness} with the members of a JSON object, all kept. */
037    public static ServingCompleteness fromJson(Object json) {
038        return new ServingCompleteness(members(json, "ServingCompleteness"));
039    }
040
041    public static Builder builder() {
042        return new Builder(null);
043    }
044
045    /** A builder holding every member of this object. */
046    public Builder toBuilder() {
047        return new Builder(toJson());
048    }
049
050    /**
051     * The member {@code status}. Whether a served result was truncated. Registry group
052     * 'servingCompleteness' (Section 4.4). Null when absent; throws IllegalStateException when the
053     * member holds another JSON type.
054     */
055    public String getStatus() {
056        return string("status");
057    }
058
059    /**
060     * The member {@code truncations}. Null when absent; throws IllegalStateException when the
061     * member holds another JSON type.
062     */
063    public List<Truncation> getTruncations() {
064        return typed("truncations", listOf(Truncation.READER));
065    }
066
067    /**
068     * The member {@code extensions}. Extension data keyed by namespace. Every core object may carry
069     * it; it never takes part in a core identity. Null when absent; throws IllegalStateException
070     * when the member holds another JSON type.
071     */
072    public Map<String, Extension> getExtensions() {
073        return typed("extensions", mapOf(Extension.READER));
074    }
075
076    /** Collects the members of a new {@code ServingCompleteness}. */
077    public static final class Builder extends SqllrObject.Builder<ServingCompleteness, Builder> {
078        private Builder(Map<String, Object> from) {
079            super(from);
080        }
081
082        /** Sets the member {@code status}; null removes it. */
083        public Builder status(String value) {
084            return set("status", value);
085        }
086
087        /** Sets the member {@code truncations}; null removes it. */
088        public Builder truncations(List<Truncation> value) {
089            return set("truncations", value);
090        }
091
092        /** Sets the member {@code extensions}; null removes it. */
093        public Builder extensions(Map<String, Extension> value) {
094            return set("extensions", value);
095        }
096
097        @Override
098        public ServingCompleteness build() {
099            return new ServingCompleteness(frozenMembers());
100        }
101    }
102}