/*
 * This file is generated by jOOQ.
 */

package stroom.proxy.repo.db.jooq.tables;


import stroom.proxy.repo.db.jooq.DefaultSchema;
import stroom.proxy.repo.db.jooq.Indexes;
import stroom.proxy.repo.db.jooq.Keys;
import stroom.proxy.repo.db.jooq.tables.records.ForwardSourceRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row10;
import org.jooq.Schema;
import org.jooq.Table;
import org.jooq.TableField;
import org.jooq.TableOptions;
import org.jooq.UniqueKey;
import org.jooq.impl.DSL;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import java.util.Arrays;
import java.util.List;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({"all", "unchecked", "rawtypes"})
public class ForwardSource extends TableImpl<ForwardSourceRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>forward_source</code>
     */
    public static final ForwardSource FORWARD_SOURCE = new ForwardSource();

    /**
     * The class holding records for this type
     */
    @Override
    public Class<ForwardSourceRecord> getRecordType() {
        return ForwardSourceRecord.class;
    }

    /**
     * The column <code>forward_source.id</code>.
     */
    public final TableField<ForwardSourceRecord, Long> ID = createField(DSL.name("id"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>forward_source.update_time_ms</code>.
     */
    public final TableField<ForwardSourceRecord, Long> UPDATE_TIME_MS = createField(DSL.name("update_time_ms"),
            SQLDataType.BIGINT.nullable(false),
            this,
            "");

    /**
     * The column <code>forward_source.fk_forward_dest_id</code>.
     */
    public final TableField<ForwardSourceRecord, Integer> FK_FORWARD_DEST_ID = createField(DSL.name("fk_forward_dest_id"),
            SQLDataType.INTEGER.nullable(false),
            this,
            "");

    /**
     * The column <code>forward_source.fk_source_id</code>.
     */
    public final TableField<ForwardSourceRecord, Long> FK_SOURCE_ID = createField(DSL.name("fk_source_id"),
            SQLDataType.BIGINT.nullable(false),
            this,
            "");

    /**
     * The column <code>forward_source.success</code>.
     */
    public final TableField<ForwardSourceRecord, Boolean> SUCCESS = createField(DSL.name("success"),
            SQLDataType.BOOLEAN.nullable(false),
            this,
            "");

    /**
     * The column <code>forward_source.error</code>.
     */
    public final TableField<ForwardSourceRecord, String> ERROR = createField(DSL.name("error"),
            SQLDataType.VARCHAR(255),
            this,
            "");

    /**
     * The column <code>forward_source.tries</code>.
     */
    public final TableField<ForwardSourceRecord, Long> TRIES = createField(DSL.name("tries"),
            SQLDataType.BIGINT.defaultValue(DSL.field("0", SQLDataType.BIGINT)),
            this,
            "");

    /**
     * The column <code>forward_source.last_try_time_ms</code>.
     */
    public final TableField<ForwardSourceRecord, Long> LAST_TRY_TIME_MS = createField(DSL.name("last_try_time_ms"),
            SQLDataType.BIGINT.defaultValue(DSL.field("0", SQLDataType.BIGINT)),
            this,
            "");

    /**
     * The column <code>forward_source.new_position</code>.
     */
    public final TableField<ForwardSourceRecord, Long> NEW_POSITION = createField(DSL.name("new_position"),
            SQLDataType.BIGINT,
            this,
            "");

    /**
     * The column <code>forward_source.retry_position</code>.
     */
    public final TableField<ForwardSourceRecord, Long> RETRY_POSITION = createField(DSL.name("retry_position"),
            SQLDataType.BIGINT,
            this,
            "");

    private ForwardSource(Name alias, Table<ForwardSourceRecord> aliased) {
        this(alias, aliased, null);
    }

    private ForwardSource(Name alias, Table<ForwardSourceRecord> aliased, Field<?>[] parameters) {
        super(alias, null, aliased, parameters, DSL.comment(""), TableOptions.table());
    }

    /**
     * Create an aliased <code>forward_source</code> table reference
     */
    public ForwardSource(String alias) {
        this(DSL.name(alias), FORWARD_SOURCE);
    }

    /**
     * Create an aliased <code>forward_source</code> table reference
     */
    public ForwardSource(Name alias) {
        this(alias, FORWARD_SOURCE);
    }

    /**
     * Create a <code>forward_source</code> table reference
     */
    public ForwardSource() {
        this(DSL.name("forward_source"), null);
    }

    public <O extends Record> ForwardSource(Table<O> child, ForeignKey<O, ForwardSourceRecord> key) {
        super(child, key, FORWARD_SOURCE);
    }

    @Override
    public Schema getSchema() {
        return aliased()
                ? null
                : DefaultSchema.DEFAULT_SCHEMA;
    }

    @Override
    public List<Index> getIndexes() {
        return Arrays.asList(Indexes.NEW_POSITION_FORWARD_SOURCE_INDEX, Indexes.RETRY_POSITION_FORWARD_SOURCE_INDEX);
    }

    @Override
    public UniqueKey<ForwardSourceRecord> getPrimaryKey() {
        return Keys.FORWARD_SOURCE__;
    }

    @Override
    public ForwardSource as(String alias) {
        return new ForwardSource(DSL.name(alias), this);
    }

    @Override
    public ForwardSource as(Name alias) {
        return new ForwardSource(alias, this);
    }

    /**
     * Rename this table
     */
    @Override
    public ForwardSource rename(String name) {
        return new ForwardSource(DSL.name(name), null);
    }

    /**
     * Rename this table
     */
    @Override
    public ForwardSource rename(Name name) {
        return new ForwardSource(name, null);
    }

    // -------------------------------------------------------------------------
    // Row10 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row10<Long, Long, Integer, Long, Boolean, String, Long, Long, Long, Long> fieldsRow() {
        return (Row10) super.fieldsRow();
    }
}
