/*
 * Copyright (c) 2014-2021, by Alex Leigh.
 * All rights reserved.
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE
 * The copyright notice above does not evidence any
 * actual or intended publication of such source code.
 */

package leigh.esp.goryu.sdk.schema.v1;

import leigh.eo.EO;
import leigh.eo.EOLoop;

/**
 * This is a dynamically generated DAO class for accessing objects within an ESP graph. This class
 * has been generated by <code>DAOGenerator</code> and should not be modified.
 *
 * @author DAOGenerator (synthetically generated class)
 */
public final class SubStreamingMutationElementDAO {
    public static final String API_TYPE = "leigh.esp.goryu.v1.SubStreamingMutation";

    public static EO create() {
        EO eo = new EO(API_TYPE);
        return eo;
    }

    public static boolean assertType(final EO eo) {
        return eo.getApiType().equals(API_TYPE);
    }

    public static final String KEY_QUERY = "query";
    public static final String KEY_GENERATEDKEYNAME = "generatedKeyName";
    public static final String KEY_DATAATTRIBUTENAME = "dataAttributeName";
    public static final String KEY_SUBQUERIES = "subQueries";

    public static String apiType(final EO eo) {
        return eo.getApiType();
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=query, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Query Text, locale=en}, meta=null}]} , type=string}, meta=null} */


    public static java.lang.String getQuery(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueString(KEY_QUERY);
    }

    public static void setQuery(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValue(KEY_QUERY, value);
    }

    public static void setQueryLabel(final EO eo, final String label) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setLabel(KEY_QUERY, label);
    }

    public static void getLabelOrValueQuery(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.getLabelOrValue(KEY_QUERY);
    }

    public static void setIfUnsetQuery(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValueIfUnset(KEY_QUERY, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=generatedKeyName, label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Generated Key Name, locale=en}, meta=null}]} , type=string}, meta=null} */


    public static java.lang.String getGeneratedKeyName(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueString(KEY_GENERATEDKEYNAME);
    }

    public static void setGeneratedKeyName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValue(KEY_GENERATEDKEYNAME, value);
    }

    public static void setGeneratedKeyNameLabel(final EO eo, final String label) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setLabel(KEY_GENERATEDKEYNAME, label);
    }

    public static void getLabelOrValueGeneratedKeyName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.getLabelOrValue(KEY_GENERATEDKEYNAME);
    }

    public static void setIfUnsetGeneratedKeyName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValueIfUnset(KEY_GENERATEDKEYNAME, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=dataAttributeName, validators=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.ValidatorNotEmpty', data={}, meta=null}]} , label=EOLoop{array=[EO{typeName='leigh.esp.eo.schema.Text', data={text=Data Attribute Name, locale=en}, meta=null}]} , type=string}, meta=null} */


    public static java.lang.String getDataAttributeName(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueString(KEY_DATAATTRIBUTENAME);
    }

    public static void setDataAttributeName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValue(KEY_DATAATTRIBUTENAME, value);
    }

    public static void setDataAttributeNameLabel(final EO eo, final String label) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setLabel(KEY_DATAATTRIBUTENAME, label);
    }

    public static void getLabelOrValueDataAttributeName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.getLabelOrValue(KEY_DATAATTRIBUTENAME);
    }

    public static void setIfUnsetDataAttributeName(final EO eo, java.lang.String value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValueIfUnset(KEY_DATAATTRIBUTENAME, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Loop', data={acceptTypes=EOLoop{array=null} , apiName=subQueries, label=SubQueries}, meta=null} */

    public static void appendSubQueries(EO eo, EO label) {
        EOLoop loop = eo.getValueLoop(KEY_SUBQUERIES);
        loop.add(label);
    }


    public static EOLoop getSubQueries(EO eo) {
        EOLoop o = eo.getValueLoop(KEY_SUBQUERIES);
        if (o == null) {
            o = new EOLoop();
            eo.setValue(KEY_SUBQUERIES, o);
        }
        return o;
    }

    public static void setSubQueries(final EO eo, EOLoop value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValue(KEY_SUBQUERIES, value);
    }

    public static void setSubQueriesLabel(final EO eo, final String label) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setLabel(KEY_SUBQUERIES, label);
    }

    public static void getLabelOrValueSubQueries(final EO eo, EOLoop value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.getLabelOrValue(KEY_SUBQUERIES);
    }

    public static void setIfUnsetSubQueries(final EO eo, EOLoop value) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        eo.setValueIfUnset(KEY_SUBQUERIES, value);
    }


}