/*
 * This file is generated by jOOQ.
 */
package ru.micord.webbpm.ervu.business_metrics.db_beans.auth.tables;


import java.util.Collection;

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.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.micord.webbpm.ervu.business_metrics.db_beans.auth.Auth;
import ru.micord.webbpm.ervu.business_metrics.db_beans.auth.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.auth.tables.records.ActiveSessionRecord;


/**
 * Активные сессии пользователей
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class ActiveSession extends TableImpl<ActiveSessionRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>auth.active_session</code>
     */
    public static final ActiveSession ACTIVE_SESSION = new ActiveSession();

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

    /**
     * The column <code>auth.active_session.session_id</code>. Идентификатор
     * сессии
     */
    public final TableField<ActiveSessionRecord, String> SESSION_ID = createField(DSL.name("session_id"), SQLDataType.VARCHAR(128).nullable(false), this, "Идентификатор сессии");

    /**
     * The column <code>auth.active_session.domain_id</code>. Идентификатор
     * домена
     */
    public final TableField<ActiveSessionRecord, String> DOMAIN_ID = createField(DSL.name("domain_id"), SQLDataType.VARCHAR(128).nullable(false), this, "Идентификатор домена");

    /**
     * The column <code>auth.active_session.user_id</code>. Идентификатор
     * пользователя
     */
    public final TableField<ActiveSessionRecord, String> USER_ID = createField(DSL.name("user_id"), SQLDataType.VARCHAR(128).nullable(false), this, "Идентификатор пользователя");

    /**
     * The column <code>auth.active_session.ip_address</code>. IP-адрес
     * пользователя
     */
    public final TableField<ActiveSessionRecord, String> IP_ADDRESS = createField(DSL.name("ip_address"), SQLDataType.VARCHAR(64), this, "IP-адрес пользователя");

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

    private ActiveSession(Name alias, Table<ActiveSessionRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Активные сессии пользователей"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>auth.active_session</code> table reference
     */
    public ActiveSession(String alias) {
        this(DSL.name(alias), ACTIVE_SESSION);
    }

    /**
     * Create an aliased <code>auth.active_session</code> table reference
     */
    public ActiveSession(Name alias) {
        this(alias, ACTIVE_SESSION);
    }

    /**
     * Create a <code>auth.active_session</code> table reference
     */
    public ActiveSession() {
        this(DSL.name("active_session"), null);
    }

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

    @Override
    public UniqueKey<ActiveSessionRecord> getPrimaryKey() {
        return Keys.PK_ACTIVE_SESSION;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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