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


import stroom.job.impl.db.jooq.Keys;
import stroom.job.impl.db.jooq.Stroom;
import stroom.job.impl.db.jooq.tables.records.JobRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Row8;
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 Job extends TableImpl<JobRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>stroom.job</code>
     */
    public static final Job JOB = new Job();

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

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

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

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

    /**
     * The column <code>stroom.job.create_user</code>.
     */
    public final TableField<JobRecord, String> CREATE_USER = createField(DSL.name("create_user"), SQLDataType.VARCHAR(255).nullable(false), this, "");

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

    /**
     * The column <code>stroom.job.update_user</code>.
     */
    public final TableField<JobRecord, String> UPDATE_USER = createField(DSL.name("update_user"), SQLDataType.VARCHAR(255).nullable(false), this, "");

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

    /**
     * The column <code>stroom.job.enabled</code>.
     */
    public final TableField<JobRecord, Boolean> ENABLED = createField(DSL.name("enabled"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.inline("0", SQLDataType.BOOLEAN)), this, "");

    private Job(Name alias, Table<JobRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>stroom.job</code> table reference
     */
    public Job(Name alias) {
        this(alias, JOB);
    }

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

    public <O extends Record> Job(Table<O> child, ForeignKey<O, JobRecord> key) {
        super(child, key, JOB);
    }

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

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

    @Override
    public UniqueKey<JobRecord> getPrimaryKey() {
        return Keys.KEY_JOB_PRIMARY;
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row8 type methods
    // -------------------------------------------------------------------------

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