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


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.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.Account.AccountPath;
import ru.micord.webbpm.ervu.business_metrics.db_beans.idm_reconcile.tables.records.AccountRoleRecord;


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

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>idm_reconcile.account_role</code>
     */
    public static final AccountRole ACCOUNT_ROLE = new AccountRole();

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

    /**
     * The column <code>idm_reconcile.account_role.account_id</code>.
     */
    public final TableField<AccountRoleRecord, String> ACCOUNT_ID = createField(DSL.name("account_id"), SQLDataType.VARCHAR(36).nullable(false), this, "");

    /**
     * The column <code>idm_reconcile.account_role.role_id</code>.
     */
    public final TableField<AccountRoleRecord, String> ROLE_ID = createField(DSL.name("role_id"), SQLDataType.VARCHAR(36).nullable(false), this, "");

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

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

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

    /**
     * Create an aliased <code>idm_reconcile.account_role</code> table reference
     */
    public AccountRole(Name alias) {
        this(alias, ACCOUNT_ROLE);
    }

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

    public <O extends Record> AccountRole(Table<O> path, ForeignKey<O, AccountRoleRecord> childPath, InverseForeignKey<O, AccountRoleRecord> parentPath) {
        super(path, childPath, parentPath, ACCOUNT_ROLE);
    }

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

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

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

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

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

    @Override
    public UniqueKey<AccountRoleRecord> getPrimaryKey() {
        return Keys.PK_ACCOUNT_ROLE;
    }

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

    private transient AccountPath _account;

    /**
     * Get the implicit join path to the <code>idm_reconcile.account</code>
     * table.
     */
    public AccountPath account() {
        if (_account == null)
            _account = new AccountPath(this, Keys.ACCOUNT_ROLE__FK_ACCOUNT_ROLE_ACCOUNT, null);

        return _account;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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