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


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

import org.jooq.Check;
import org.jooq.Condition;
import org.jooq.Field;
import org.jooq.Identity;
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.Internal;
import org.jooq.impl.SQLDataType;
import org.jooq.impl.TableImpl;

import ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.Deregistration;
import ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.Keys;
import ru.micord.webbpm.ervu.business_metrics.db_beans.deregistration.tables.records.SolutionsRecord;


/**
 * Снятие с воинского учета. Решение о снятии с ВУ
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class Solutions extends TableImpl<SolutionsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>deregistration.solutions</code>
     */
    public static final Solutions SOLUTIONS = new Solutions();

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

    /**
     * The column <code>deregistration.solutions.solutions_id</code>.
     */
    public final TableField<SolutionsRecord, Long> SOLUTIONS_ID = createField(DSL.name("solutions_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column <code>deregistration.solutions.info_source</code>. информация
     * об источнике - GIR_VU, EPGU, PERSONAL_VISIT, MANUAL
     */
    public final TableField<SolutionsRecord, String> INFO_SOURCE = createField(DSL.name("info_source"), SQLDataType.VARCHAR.nullable(false), this, "информация об источнике - GIR_VU, EPGU, PERSONAL_VISIT, MANUAL");

    /**
     * The column <code>deregistration.solutions.count_accepted_signed</code>.
     * решений о снятии подписано
     */
    public final TableField<SolutionsRecord, Long> COUNT_ACCEPTED_SIGNED = createField(DSL.name("count_accepted_signed"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "решений о снятии подписано");

    /**
     * The column <code>deregistration.solutions.count_accepted_for_sign</code>.
     * решений о снятии доступно для подписания
     */
    public final TableField<SolutionsRecord, Long> COUNT_ACCEPTED_FOR_SIGN = createField(DSL.name("count_accepted_for_sign"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "решений о снятии доступно для подписания");

    /**
     * The column <code>deregistration.solutions.count_refused</code>.
     */
    public final TableField<SolutionsRecord, Long> COUNT_REFUSED = createField(DSL.name("count_refused"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "");

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

    private Solutions(Name alias, Table<SolutionsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Снятие с воинского учета. Решение о снятии с ВУ"), TableOptions.table(), where);
    }

    /**
     * Create an aliased <code>deregistration.solutions</code> table reference
     */
    public Solutions(String alias) {
        this(DSL.name(alias), SOLUTIONS);
    }

    /**
     * Create an aliased <code>deregistration.solutions</code> table reference
     */
    public Solutions(Name alias) {
        this(alias, SOLUTIONS);
    }

    /**
     * Create a <code>deregistration.solutions</code> table reference
     */
    public Solutions() {
        this(DSL.name("solutions"), null);
    }

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

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

    @Override
    public UniqueKey<SolutionsRecord> getPrimaryKey() {
        return Keys.SOLUTIONS_PKEY;
    }

    @Override
    public List<Check<SolutionsRecord>> getChecks() {
        return Arrays.asList(
            Internal.createCheck(this, DSL.name("chk_info_source"), "(((info_source)::text = ANY (ARRAY[('PERSONAL_VISIT'::character varying)::text, ('GIR_VU'::character varying)::text, ('EPGU'::character varying)::text, ('MANUAL'::character varying)::text])))", true)
        );
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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