/*
 * This file is generated by jOOQ.
 */
package ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables;


import java.sql.Timestamp;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import org.jooq.Check;
import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Name;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.SQL;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Stringly;
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.Internal;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.ErvuDashboard;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.Keys;
import ru.micord.ervu_dashboard.db_beans.ervu_dashboard.tables.records.VehicleCategoriesRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>ervu_dashboard.vehicle_categories</code>
     */
    public static final VehicleCategories VEHICLE_CATEGORIES = new VehicleCategories();

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

    /**
     * The column <code>ervu_dashboard.vehicle_categories.code</code>.
     */
    public final TableField<VehicleCategoriesRecord, String> CODE = createField(DSL.name("code"), SQLDataType.VARCHAR(5).nullable(false), this, "");

    /**
     * The column <code>ervu_dashboard.vehicle_categories.name</code>.
     */
    public final TableField<VehicleCategoriesRecord, String> NAME = createField(DSL.name("name"), SQLDataType.CLOB.nullable(false), this, "");

    /**
     * The column <code>ervu_dashboard.vehicle_categories.description</code>.
     */
    public final TableField<VehicleCategoriesRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.CLOB, this, "");

    /**
     * The column
     * <code>ervu_dashboard.vehicle_categories.is_driver_license</code>.
     */
    public final TableField<VehicleCategoriesRecord, Boolean> IS_DRIVER_LICENSE = createField(DSL.name("is_driver_license"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("true"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>ervu_dashboard.vehicle_categories.created_at</code>.
     */
    public final TableField<VehicleCategoriesRecord, Timestamp> CREATED_AT = createField(DSL.name("created_at"), SQLDataType.TIMESTAMP(0).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.TIMESTAMP)), this, "");

    /**
     * The column <code>ervu_dashboard.vehicle_categories.updated_at</code>.
     */
    public final TableField<VehicleCategoriesRecord, Timestamp> UPDATED_AT = createField(DSL.name("updated_at"), SQLDataType.TIMESTAMP(0).defaultValue(DSL.field(DSL.raw("CURRENT_TIMESTAMP"), SQLDataType.TIMESTAMP)), this, "");

    private VehicleCategories(Name alias, Table<VehicleCategoriesRecord> aliased) {
        this(alias, aliased, (Field<?>[]) null, null);
    }

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

    /**
     * Create an aliased <code>ervu_dashboard.vehicle_categories</code> table
     * reference
     */
    public VehicleCategories(String alias) {
        this(DSL.name(alias), VEHICLE_CATEGORIES);
    }

    /**
     * Create an aliased <code>ervu_dashboard.vehicle_categories</code> table
     * reference
     */
    public VehicleCategories(Name alias) {
        this(alias, VEHICLE_CATEGORIES);
    }

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

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

    @Override
    public UniqueKey<VehicleCategoriesRecord> getPrimaryKey() {
        return Keys.VEHICLE_CATEGORIES_PKEY;
    }

    @Override
    public List<Check<VehicleCategoriesRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("vehicle_categories_code_check"), "(((length((code)::text) >= 1) AND (length((code)::text) <= 5)))", true)
        );
    }

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

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

    @Override
    public VehicleCategories as(Table<?> alias) {
        return new VehicleCategories(alias.getQualifiedName(), this);
    }

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

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

    /**
     * Rename this table
     */
    @Override
    public VehicleCategories rename(Table<?> name) {
        return new VehicleCategories(name.getQualifiedName(), null);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories where(Condition condition) {
        return new VehicleCategories(getQualifiedName(), aliased() ? this : null, null, condition);
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories where(Collection<? extends Condition> conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories where(Condition... conditions) {
        return where(DSL.and(conditions));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories where(Field<Boolean> condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public VehicleCategories where(SQL condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public VehicleCategories where(@Stringly.SQL String condition) {
        return where(DSL.condition(condition));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public VehicleCategories where(@Stringly.SQL String condition, Object... binds) {
        return where(DSL.condition(condition, binds));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    @PlainSQL
    public VehicleCategories where(@Stringly.SQL String condition, QueryPart... parts) {
        return where(DSL.condition(condition, parts));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories whereExists(Select<?> select) {
        return where(DSL.exists(select));
    }

    /**
     * Create an inline derived table from this table
     */
    @Override
    public VehicleCategories whereNotExists(Select<?> select) {
        return where(DSL.notExists(select));
    }
}
