/*
 * Copyright (c) 2004-2017, 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.eo.schema.dao;

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 FieldElementDAO {
    public static final String API_TYPE = "org.a6v.esp.eo.schema.Field";

    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_APINAME = "apiName";
    public static final String KEY_LABEL = "label";
    public static final String KEY_TYPE = "type";
    public static final String KEY_ISCASEINSENSITIVE = "isCaseInsensitive";
    public static final String KEY_ISHIDDEN = "isHidden";
    public static final String KEY_ISPROTECTED = "isProtected";
    public static final String KEY_FIXEDCHOICES = "fixedChoices";
    public static final String KEY_VALIDATORS = "validators";
    public static final String KEY_HELP = "help";
    public static final String KEY_DEFAULTVALUE = "defaultValue";

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

    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=apiName, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=API Name, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@134dd9f0]} org.a6v.esp.eo.EOLoop@134dda0f, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@33b498 */

    public static java.lang.String getApiName(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_APINAME);

    }

    public static void setApiName(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_APINAME, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Loop', data={acceptTypes=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.AcceptType', data={elementApiName=org.a6v.esp.eo.schema.Text}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@d962a4a2]} org.a6v.esp.eo.EOLoop@d962a4c1, apiName=label, label=Label}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@c6fa5811 */

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

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

    }

    public static void setLabel(final EO eo, EOLoop value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_LABEL, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=type, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Type, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@acbd582b]} org.a6v.esp.eo.EOLoop@acbd584a, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@65f47b5a */


    public static java.lang.String getType(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_TYPE);

    }

    public static void setType(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_TYPE, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=isCaseInsensitive, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Case Insensitive, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@d10c54c0]} org.a6v.esp.eo.EOLoop@d10c54df, type=bool}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@e183315f */


    public static java.lang.Boolean getIsCaseInsensitive(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueBoolean(KEY_ISCASEINSENSITIVE);

    }

    public static void setIsCaseInsensitive(final EO eo, java.lang.Boolean value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_ISCASEINSENSITIVE, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=isHidden, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Hidden, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@2d84de9b]} org.a6v.esp.eo.EOLoop@2d84deba, type=bool}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@5b8dbb41 */


    public static java.lang.Boolean getIsHidden(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueBoolean(KEY_ISHIDDEN);

    }

    public static void setIsHidden(final EO eo, java.lang.Boolean value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_ISHIDDEN, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=isProtected, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Protected, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@ffb9e057]} org.a6v.esp.eo.EOLoop@ffb9e076, type=bool}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@b6cdb25 */


    public static java.lang.Boolean getIsProtected(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueBoolean(KEY_ISPROTECTED);

    }

    public static void setIsProtected(final EO eo, java.lang.Boolean value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_ISPROTECTED, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Loop', data={acceptTypes=EOLoop{array=null} org.a6v.esp.eo.EOLoop@0, apiName=fixedChoices, label=Fixed Choices}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@b250568e */

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

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

    }

    public static void setFixedChoices(final EO eo, EOLoop value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_FIXEDCHOICES, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Loop', data={acceptTypes=EOLoop{array=null} org.a6v.esp.eo.EOLoop@0, apiName=validators, label=Validators}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@b502e89a */

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

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

    }

    public static void setValidators(final EO eo, EOLoop value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_VALIDATORS, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=help, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Help Text, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@6e153135]} org.a6v.esp.eo.EOLoop@6e153154, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@236263c1 */


    public static java.lang.String getHelp(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_HELP);

    }

    public static void setHelp(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_HELP, value);
    }


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=defaultValue, label=EOLoop{array=[EO{typeName='org.a6v.esp.eo.schema.Text', data={text=Default Value, locale=en}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@bd611573]} org.a6v.esp.eo.EOLoop@bd611592, type=string}, errors={}, globalErrors=[]} org.a6v.esp.eo.EO@af50bb78 */


    public static java.lang.String getDefaultValue(EO eo) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        return eo.getValueString(KEY_DEFAULTVALUE);

    }

    public static void setDefaultValue(final EO eo, java.lang.String value) {
        if (!assertType(eo)) throw new IllegalArgumentException("Mismatched EO type: " + eo.getApiType());
        eo.setValue(KEY_DEFAULTVALUE, value);
    }


}