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


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

import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.ForeignKey;
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.idm_reconcile.IdmReconcile;
import ru.micord.webbpm.ervu.business_metrics.db_beans.idm_reconcile.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.idm_reconcile.tables.AccountRole.AccountRolePath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.idm_reconcile.tables.records.AccountRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>idm_reconcile.account</code>
     */
    public static final Account ACCOUNT = new Account();

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

    /**
     * The column <code>idm_reconcile.account.id</code>.
     */
    public final TableField<AccountRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(36).nullable(false), this, "");

    /**
     * The column <code>idm_reconcile.account.version</code>.
     */
    public final TableField<AccountRecord, Integer> VERSION = createField(DSL.name("version"), SQLDataType.INTEGER.nullable(false), this, "");

    /**
     * The column <code>idm_reconcile.account.modified</code>.
     */
    public final TableField<AccountRecord, Timestamp> MODIFIED = createField(DSL.name("modified"), SQLDataType.TIMESTAMP(0), this, "");

    /**
     * The column <code>idm_reconcile.account.schema</code>.
     */
    public final TableField<AccountRecord, String> SCHEMA = createField(DSL.name("schema"), SQLDataType.VARCHAR(100).nullable(false), this, "");

    /**
     * The column <code>idm_reconcile.account.start</code>.
     */
    public final TableField<AccountRecord, String> START = createField(DSL.name("start"), SQLDataType.VARCHAR(50), this, "");

    /**
     * The column <code>idm_reconcile.account.finish</code>.
     */
    public final TableField<AccountRecord, String> FINISH = createField(DSL.name("finish"), SQLDataType.VARCHAR(50), this, "");

    /**
     * The column <code>idm_reconcile.account.enabled</code>.
     */
    public final TableField<AccountRecord, Boolean> ENABLED = createField(DSL.name("enabled"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("true"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>idm_reconcile.account.position</code>.
     */
    public final TableField<AccountRecord, String> POSITION = createField(DSL.name("position"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>idm_reconcile.account.fio</code>.
     */
    public final TableField<AccountRecord, String> FIO = createField(DSL.name("fio"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>idm_reconcile.account.work_mail</code>.
     */
    public final TableField<AccountRecord, String> WORK_MAIL = createField(DSL.name("work_mail"), SQLDataType.VARCHAR(255), this, "");

    /**
     * The column <code>idm_reconcile.account.esia_account</code>.
     */
    public final TableField<AccountRecord, Boolean> ESIA_ACCOUNT = createField(DSL.name("esia_account"), SQLDataType.BOOLEAN.nullable(false).defaultValue(DSL.field(DSL.raw("false"), SQLDataType.BOOLEAN)), this, "");

    /**
     * The column <code>idm_reconcile.account.domain_id</code>.
     */
    public final TableField<AccountRecord, String> DOMAIN_ID = createField(DSL.name("domain_id"), SQLDataType.VARCHAR(36), this, "");

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

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

    /**
     * Create an aliased <code>idm_reconcile.account</code> table reference
     */
    public Account(String alias) {
        this(DSL.name(alias), ACCOUNT);
    }

    /**
     * Create an aliased <code>idm_reconcile.account</code> table reference
     */
    public Account(Name alias) {
        this(alias, ACCOUNT);
    }

    /**
     * Create a <code>idm_reconcile.account</code> table reference
     */
    public Account() {
        this(DSL.name("account"), null);
    }

    public <O extends Record> Account(Table<O> path, ForeignKey<O, AccountRecord> childPath, InverseForeignKey<O, AccountRecord> parentPath) {
        super(path, childPath, parentPath, ACCOUNT);
    }

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

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

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

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

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

    @Override
    public UniqueKey<AccountRecord> getPrimaryKey() {
        return Keys.ACCOUNT_PKEY;
    }

    private transient AccountRolePath _accountRole;

    /**
     * Get the implicit to-many join path to the
     * <code>idm_reconcile.account_role</code> table
     */
    public AccountRolePath accountRole() {
        if (_accountRole == null)
            _accountRole = new AccountRolePath(this, null, Keys.ACCOUNT_ROLE__FK_ACCOUNT_ROLE_ACCOUNT.getInverseKey());

        return _accountRole;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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