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


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

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Identity;
import org.jooq.InverseForeignKey;
import org.jooq.Name;
import org.jooq.Path;
import org.jooq.PlainSQL;
import org.jooq.QueryPart;
import org.jooq.Record;
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.journal_log.JournalLog;
import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.journal_log.tables.records.UserInfoRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Users.UsersPath;


/**
 * Журналирование. Информация о пользователе
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class UserInfo extends TableImpl<UserInfoRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>journal_log.user_info</code>
     */
    public static final UserInfo USER_INFO = new UserInfo();

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

    /**
     * The column <code>journal_log.user_info.user_info_id</code>.
     */
    public final TableField<UserInfoRecord, Long> USER_INFO_ID = createField(DSL.name("user_info_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

    /**
     * The column <code>journal_log.user_info.recruitment_id</code>.
     */
    public final TableField<UserInfoRecord, String> RECRUITMENT_ID = createField(DSL.name("recruitment_id"), SQLDataType.VARCHAR(36).nullable(false), this, "");

    /**
     * The column <code>journal_log.user_info.user_id</code>.
     */
    public final TableField<UserInfoRecord, Long> USER_ID = createField(DSL.name("user_id"), SQLDataType.BIGINT.nullable(false), this, "");

    /**
     * The column <code>journal_log.user_info.update_date</code>.
     */
    public final TableField<UserInfoRecord, Timestamp> UPDATE_DATE = createField(DSL.name("update_date"), SQLDataType.TIMESTAMP(0).nullable(false).defaultValue(DSL.field(DSL.raw("now()"), SQLDataType.TIMESTAMP)), this, "");

    /**
     * The column <code>journal_log.user_info.info_date</code>.
     */
    public final TableField<UserInfoRecord, Date> INFO_DATE = createField(DSL.name("info_date"), SQLDataType.DATE.nullable(false), this, "");

    /**
     * The column <code>journal_log.user_info.count_role</code>.
     */
    public final TableField<UserInfoRecord, Long> COUNT_ROLE = createField(DSL.name("count_role"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.user_info.count_error</code>.
     */
    public final TableField<UserInfoRecord, Long> COUNT_ERROR = createField(DSL.name("count_error"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.user_info.count_authentication</code>.
     */
    public final TableField<UserInfoRecord, Long> COUNT_AUTHENTICATION = createField(DSL.name("count_authentication"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

    /**
     * The column <code>journal_log.user_info.count_work_together</code>.
     */
    public final TableField<UserInfoRecord, Long> COUNT_WORK_TOGETHER = createField(DSL.name("count_work_together"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private UserInfo(Name alias, Table<UserInfoRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Журналирование. Информация о пользователе"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>journal_log.user_info</code> table reference
     */
    public UserInfo(String alias) {
        this(DSL.name(alias), USER_INFO);
    }

    /**
     * Create an aliased <code>journal_log.user_info</code> table reference
     */
    public UserInfo(Name alias) {
        this(alias, USER_INFO);
    }

    /**
     * Create a <code>journal_log.user_info</code> table reference
     */
    public UserInfo() {
        this(DSL.name("user_info"), null);
    }

    public <O extends Record> UserInfo(Table<O> path, ForeignKey<O, UserInfoRecord> childPath, InverseForeignKey<O, UserInfoRecord> parentPath) {
        super(path, childPath, parentPath, USER_INFO);
    }

    /**
     * A subtype implementing {@link Path} for simplified path-based joins.
     */
    public static class UserInfoPath extends UserInfo implements Path<UserInfoRecord> {
        public <O extends Record> UserInfoPath(Table<O> path, ForeignKey<O, UserInfoRecord> childPath, InverseForeignKey<O, UserInfoRecord> parentPath) {
            super(path, childPath, parentPath);
        }
        private UserInfoPath(Name alias, Table<UserInfoRecord> aliased) {
            super(alias, aliased);
        }

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

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

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

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

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

    @Override
    public UniqueKey<UserInfoRecord> getPrimaryKey() {
        return Keys.USER_INFO_PKEY;
    }

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

    private transient UsersPath _users;

    /**
     * Get the implicit join path to the <code>metrics.users</code> table.
     */
    public UsersPath users() {
        if (_users == null)
            _users = new UsersPath(this, Keys.USER_INFO__FK_USER_ID, null);

        return _users;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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