/*
 * This file is generated by jOOQ.
 */
package stroom.processor.impl.db.jooq.tables;


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

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Index;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row12;
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 stroom.processor.impl.db.jooq.Indexes;
import stroom.processor.impl.db.jooq.Keys;
import stroom.processor.impl.db.jooq.Stroom;
import stroom.processor.impl.db.jooq.tables.records.ProcessorTaskRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>stroom.processor_task</code>
     */
    public static final ProcessorTask PROCESSOR_TASK = new ProcessorTask();

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

    /**
     * The column <code>stroom.processor_task.id</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> ID = createField(DSL.name("id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>stroom.processor_task.version</code>.
     */
    public final TableField<ProcessorTaskRecord, Integer> VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>stroom.processor_task.fk_processor_filter_id</code>.
     */
    public final TableField<ProcessorTaskRecord, Integer> FK_PROCESSOR_FILTER_ID = createField(DSL.name("fk_processor_filter_id"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>stroom.processor_task.fk_processor_node_id</code>.
     */
    public final TableField<ProcessorTaskRecord, Integer> FK_PROCESSOR_NODE_ID = createField(DSL.name("fk_processor_node_id"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>stroom.processor_task.fk_processor_feed_id</code>.
     */
    public final TableField<ProcessorTaskRecord, Integer> FK_PROCESSOR_FEED_ID = createField(DSL.name("fk_processor_feed_id"), SQLDataType.INTEGER, this, "");

    /**
     * The column <code>stroom.processor_task.create_time_ms</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> CREATE_TIME_MS = createField(DSL.name("create_time_ms"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>stroom.processor_task.start_time_ms</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> START_TIME_MS = createField(DSL.name("start_time_ms"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>stroom.processor_task.end_time_ms</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> END_TIME_MS = createField(DSL.name("end_time_ms"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>stroom.processor_task.status</code>.
     */
    public final TableField<ProcessorTaskRecord, Byte> STATUS = createField(DSL.name("status"), SQLDataType.TINYINT.nullable(false), this, "");

    /**
     * The column <code>stroom.processor_task.status_time_ms</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> STATUS_TIME_MS = createField(DSL.name("status_time_ms"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>stroom.processor_task.meta_id</code>.
     */
    public final TableField<ProcessorTaskRecord, Long> META_ID = createField(DSL.name("meta_id"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>stroom.processor_task.data</code>.
     */
    public final TableField<ProcessorTaskRecord, String> DATA = createField(DSL.name("data"), SQLDataType.CLOB, this, "");

    private ProcessorTask(Name alias, Table<ProcessorTaskRecord> aliased) {
        this(alias, aliased, null);
    }

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

    /**
     * Create an aliased <code>stroom.processor_task</code> table reference
     */
    public ProcessorTask(String alias) {
        this(DSL.name(alias), PROCESSOR_TASK);
    }

    /**
     * Create an aliased <code>stroom.processor_task</code> table reference
     */
    public ProcessorTask(Name alias) {
        this(alias, PROCESSOR_TASK);
    }

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

    public <O extends Record> ProcessorTask(Table<O> child, ForeignKey<O, ProcessorTaskRecord> key) {
        super(child, key, PROCESSOR_TASK);
    }

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

    @Override
    public List<Index> getIndexes() {
        return Arrays.asList(Indexes.PROCESSOR_TASK_PROCESSOR_TASK_FILTER_ID_STATUS_ID_META_ID, Indexes.PROCESSOR_TASK_PROCESSOR_TASK_META_ID_IDX, Indexes.PROCESSOR_TASK_PROCESSOR_TASK_STATUS_CREATE_TIME_MS_IDX, Indexes.PROCESSOR_TASK_PROCESSOR_TASK_STATUS_TIME_MS_STATUS_IDX);
    }

    @Override
    public Identity<ProcessorTaskRecord, Long> getIdentity() {
        return (Identity<ProcessorTaskRecord, Long>) super.getIdentity();
    }

    @Override
    public UniqueKey<ProcessorTaskRecord> getPrimaryKey() {
        return Keys.KEY_PROCESSOR_TASK_PRIMARY;
    }

    @Override
    public List<ForeignKey<ProcessorTaskRecord, ?>> getReferences() {
        return Arrays.asList(Keys.PROCESSOR_TASK_FK_PROCESSOR_FILTER_ID, Keys.PROCESSOR_TASK_FK_PROCESSOR_NODE_ID, Keys.PROCESSOR_TASK_FK_PROCESSOR_FEED_ID);
    }

    private transient ProcessorFilter _processorFilter;
    private transient ProcessorNode _processorNode;
    private transient ProcessorFeed _processorFeed;

    /**
     * Get the implicit join path to the <code>stroom.processor_filter</code>
     * table.
     */
    public ProcessorFilter processorFilter() {
        if (_processorFilter == null)
            _processorFilter = new ProcessorFilter(this, Keys.PROCESSOR_TASK_FK_PROCESSOR_FILTER_ID);

        return _processorFilter;
    }

    /**
     * Get the implicit join path to the <code>stroom.processor_node</code>
     * table.
     */
    public ProcessorNode processorNode() {
        if (_processorNode == null)
            _processorNode = new ProcessorNode(this, Keys.PROCESSOR_TASK_FK_PROCESSOR_NODE_ID);

        return _processorNode;
    }

    /**
     * Get the implicit join path to the <code>stroom.processor_feed</code>
     * table.
     */
    public ProcessorFeed processorFeed() {
        if (_processorFeed == null)
            _processorFeed = new ProcessorFeed(this, Keys.PROCESSOR_TASK_FK_PROCESSOR_FEED_ID);

        return _processorFeed;
    }

    @Override
    public TableField<ProcessorTaskRecord, Integer> getRecordVersion() {
        return VERSION;
    }

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

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

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

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

    // -------------------------------------------------------------------------
    // Row12 type methods
    // -------------------------------------------------------------------------

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