/*
 * This file is generated by jOOQ.
 */
package keywhiz.jooq.tables;


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

import keywhiz.jooq.Indexes;
import keywhiz.jooq.Keys;
import keywhiz.jooq.KeywhizdbTest;
import keywhiz.jooq.tables.records.ClientsRecord;
import keywhiz.model.TinyIntConverter;

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.Row14;
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;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>keywhizdb_test.clients</code>
     */
    public static final Clients CLIENTS = new Clients();

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

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

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

    /**
     * The column <code>keywhizdb_test.clients.updatedat</code>.
     */
    public final TableField<ClientsRecord, Long> UPDATEDAT = createField(DSL.name("updatedat"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>keywhizdb_test.clients.createdat</code>.
     */
    public final TableField<ClientsRecord, Long> CREATEDAT = createField(DSL.name("createdat"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>keywhizdb_test.clients.description</code>.
     */
    public final TableField<ClientsRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>keywhizdb_test.clients.createdby</code>.
     */
    public final TableField<ClientsRecord, String> CREATEDBY = createField(DSL.name("createdby"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>keywhizdb_test.clients.updatedby</code>.
     */
    public final TableField<ClientsRecord, String> UPDATEDBY = createField(DSL.name("updatedby"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>keywhizdb_test.clients.enabled</code>.
     */
    public final TableField<ClientsRecord, Boolean> ENABLED = createField(DSL.name("enabled"), SQLDataType.TINYINT.nullable(false).defaultValue(DSL.inline("0", SQLDataType.TINYINT)), this, "", new TinyIntConverter());

    /**
     * The column <code>keywhizdb_test.clients.automationallowed</code>.
     */
    public final TableField<ClientsRecord, Boolean> AUTOMATIONALLOWED = createField(DSL.name("automationallowed"), SQLDataType.TINYINT.nullable(false).defaultValue(DSL.inline("0", SQLDataType.TINYINT)), this, "", new TinyIntConverter());

    /**
     * The column <code>keywhizdb_test.clients.lastseen</code>.
     */
    public final TableField<ClientsRecord, Long> LASTSEEN = createField(DSL.name("lastseen"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>keywhizdb_test.clients.expiration</code>.
     */
    public final TableField<ClientsRecord, Long> EXPIRATION = createField(DSL.name("expiration"), SQLDataType.BIGINT, this, "");

    /**
     * The column <code>keywhizdb_test.clients.row_hmac</code>.
     */
    public final TableField<ClientsRecord, String> ROW_HMAC = createField(DSL.name("row_hmac"), SQLDataType.VARCHAR(64).nullable(false).defaultValue(DSL.inline("", SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>keywhizdb_test.clients.spiffe_id</code>.
     */
    public final TableField<ClientsRecord, String> SPIFFE_ID = createField(DSL.name("spiffe_id"), SQLDataType.VARCHAR(2048), this, "");

    /**
     * The column <code>keywhizdb_test.clients.owner</code>.
     */
    public final TableField<ClientsRecord, Long> OWNER = createField(DSL.name("owner"), SQLDataType.BIGINT, this, "");

    private Clients(Name alias, Table<ClientsRecord> aliased) {
        this(alias, aliased, null);
    }

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

    /**
     * Create an aliased <code>keywhizdb_test.clients</code> table reference
     */
    public Clients(String alias) {
        this(DSL.name(alias), CLIENTS);
    }

    /**
     * Create an aliased <code>keywhizdb_test.clients</code> table reference
     */
    public Clients(Name alias) {
        this(alias, CLIENTS);
    }

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

    public <O extends Record> Clients(Table<O> child, ForeignKey<O, ClientsRecord> key) {
        super(child, key, CLIENTS);
    }

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

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

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

    @Override
    public UniqueKey<ClientsRecord> getPrimaryKey() {
        return Keys.KEY_CLIENTS_PRIMARY;
    }

    @Override
    public List<UniqueKey<ClientsRecord>> getUniqueKeys() {
        return Arrays.asList(Keys.KEY_CLIENTS_NAME, Keys.KEY_CLIENTS_SPIFFE_ID_UNIQUE);
    }

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

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

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

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

    // -------------------------------------------------------------------------
    // Row14 type methods
    // -------------------------------------------------------------------------

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