/*
 * This file is generated by jOOQ.
 */
package stroom.explorer.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.Name;
import org.jooq.Record;
import org.jooq.Row4;
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.explorer.impl.db.jooq.Keys;
import stroom.explorer.impl.db.jooq.Stroom;
import stroom.explorer.impl.db.jooq.tables.records.ExplorerFavouriteRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>stroom.explorer_favourite</code>
     */
    public static final ExplorerFavourite EXPLORER_FAVOURITE = new ExplorerFavourite();

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

    /**
     * The column <code>stroom.explorer_favourite.id</code>.
     */
    public final TableField<ExplorerFavouriteRecord, Integer> ID = createField(DSL.name("id"), SQLDataType.INTEGER.nullable(false).identity(true), this, "");

    /**
     * The column <code>stroom.explorer_favourite.explorer_node_id</code>.
     */
    public final TableField<ExplorerFavouriteRecord, Integer> EXPLORER_NODE_ID = createField(DSL.name("explorer_node_id"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>stroom.explorer_favourite.user_uuid</code>.
     */
    public final TableField<ExplorerFavouriteRecord, String> USER_UUID = createField(DSL.name("user_uuid"), SQLDataType.VARCHAR(255).nullable(false), this, "");

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

    private ExplorerFavourite(Name alias, Table<ExplorerFavouriteRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>stroom.explorer_favourite</code> table reference
     */
    public ExplorerFavourite(Name alias) {
        this(alias, EXPLORER_FAVOURITE);
    }

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

    public <O extends Record> ExplorerFavourite(Table<O> child, ForeignKey<O, ExplorerFavouriteRecord> key) {
        super(child, key, EXPLORER_FAVOURITE);
    }

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

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

    @Override
    public UniqueKey<ExplorerFavouriteRecord> getPrimaryKey() {
        return Keys.KEY_EXPLORER_FAVOURITE_PRIMARY;
    }

    @Override
    public List<UniqueKey<ExplorerFavouriteRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_EXPLORER_FAVOURITE_EXPLORER_FAVOURITE_USER_UUID_EXPLORER_NODE_ID_IDX);
    }

    @Override
    public List<ForeignKey<ExplorerFavouriteRecord, ?>> getReferences() {
        return Arrays.asList(Keys.EXPLORER_FAVOURITE_EXPLORER_NODE_ID);
    }

    private transient ExplorerNode _explorerNode;

    /**
     * Get the implicit join path to the <code>stroom.explorer_node</code>
     * table.
     */
    public ExplorerNode explorerNode() {
        if (_explorerNode == null)
            _explorerNode = new ExplorerNode(this, Keys.EXPLORER_FAVOURITE_EXPLORER_NODE_ID);

        return _explorerNode;
    }

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

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

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

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

    // -------------------------------------------------------------------------
    // Row4 type methods
    // -------------------------------------------------------------------------

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