/*
 * 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.UserWorkTimeRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Users.UsersPath;


/**
 * Журналирование. Время работы пользователей
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class UserWorkTime extends TableImpl<UserWorkTimeRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>journal_log.user_work_time</code>
     */
    public static final UserWorkTime USER_WORK_TIME = new UserWorkTime();

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

    /**
     * The column <code>journal_log.user_work_time.user_work_time_id</code>.
     */
    public final TableField<UserWorkTimeRecord, Long> USER_WORK_TIME_ID = createField(DSL.name("user_work_time_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column <code>journal_log.user_work_time.update_date</code>.
     */
    public final TableField<UserWorkTimeRecord, 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_work_time.info_date</code>.
     */
    public final TableField<UserWorkTimeRecord, Date> INFO_DATE = createField(DSL.name("info_date"), SQLDataType.DATE.nullable(false), this, "");

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

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

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

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

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

    /**
     * Create an aliased <code>journal_log.user_work_time</code> table reference
     */
    public UserWorkTime(Name alias) {
        this(alias, USER_WORK_TIME);
    }

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

    public <O extends Record> UserWorkTime(Table<O> path, ForeignKey<O, UserWorkTimeRecord> childPath, InverseForeignKey<O, UserWorkTimeRecord> parentPath) {
        super(path, childPath, parentPath, USER_WORK_TIME);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<UserWorkTimeRecord> getPrimaryKey() {
        return Keys.USER_WORK_TIME_PKEY;
    }

    @Override
    public List<ForeignKey<UserWorkTimeRecord, ?>> getReferences() {
        return Arrays.asList(Keys.USER_WORK_TIME__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_WORK_TIME__FK_USER_ID, null);

        return _users;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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