/*
 * 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.teremetori.sdk.schema.v1;

import leigh.eo.EO;

/**
 * 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 TelemetryFrameElementDAO {
    public static final String API_TYPE = "leigh.teremetori.sdk.v1.TelemetryFrame";

    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_CHANNEL = "channel";
    public static final String KEY_METRICS = "metrics";
    public static final String KEY_EVENTS = "events";
    public static final String KEY_TIME = "time";

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


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=channel, 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=Events, locale=en}, meta=null}]} , type=loop}, meta=null} */


    public static leigh.eo.EOLoop getChannel(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueLoop(KEY_CHANNEL);
    }

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

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

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

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


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=metrics, 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=Metrics, locale=en}, meta=null}]} , type=loop}, meta=null} */


    public static leigh.eo.EOLoop getMetrics(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueLoop(KEY_METRICS);
    }

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

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

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

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


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=events, 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=Events, locale=en}, meta=null}]} , type=loop}, meta=null} */


    public static leigh.eo.EOLoop getEvents(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueLoop(KEY_EVENTS);
    }

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

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

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

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


    /* EO{typeName='org.a6v.esp.eo.schema.Field', data={apiName=time, 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=Time, locale=en}, meta=null}]} , type=instant}, meta=null} */


    public static java.time.Instant getTime(EO eo) {
        if (!assertType(eo))
            throw new IllegalArgumentException("Mismatched EO type: [found: " + eo.getApiType() + "] [expected: " + API_TYPE + "]");
        return eo.getValueInstant(KEY_TIME);
    }

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

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

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

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


}