/*
 * 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.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.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.GeneratedSolutionsRecord;
import ru.micord.webbpm.ervu.business_metrics.db_beans.metrics.tables.Recruitment.RecruitmentPath;


/**
 * Снятие с воинского учета. Сформированные решения
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes" })
public class GeneratedSolutions extends TableImpl<GeneratedSolutionsRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>deregistration.generated_solutions</code>
     */
    public static final GeneratedSolutions GENERATED_SOLUTIONS = new GeneratedSolutions();

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

    /**
     * The column
     * <code>deregistration.generated_solutions.generated_solutions_id</code>.
     */
    public final TableField<GeneratedSolutionsRecord, Long> GENERATED_SOLUTIONS_ID = createField(DSL.name("generated_solutions_id"), SQLDataType.BIGINT.nullable(false).identity(true), this, "");

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

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

    /**
     * The column
     * <code>deregistration.generated_solutions.count_arrived_death_reason</code>.
     * поступило по причине смерти
     */
    public final TableField<GeneratedSolutionsRecord, Long> COUNT_ARRIVED_DEATH_REASON = createField(DSL.name("count_arrived_death_reason"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "поступило по причине смерти");

    /**
     * The column
     * <code>deregistration.generated_solutions.count_arrived_age_limit</code>.
     * поступило по предельному возрасту
     */
    public final TableField<GeneratedSolutionsRecord, Long> COUNT_ARRIVED_AGE_LIMIT = createField(DSL.name("count_arrived_age_limit"), SQLDataType.BIGINT.nullable(false).defaultValue(DSL.field(DSL.raw("0"), SQLDataType.BIGINT)), this, "поступило по предельному возрасту");

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

    private GeneratedSolutions(Name alias, Table<GeneratedSolutionsRecord> aliased, Field<?>[] parameters, Condition where) {
        super(alias, null, aliased, parameters, DSL.comment("Снятие с воинского учета. Сформированные решения"), TableOptions.table(), where);
    }

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

    /**
     * Create an aliased <code>deregistration.generated_solutions</code> table
     * reference
     */
    public GeneratedSolutions(Name alias) {
        this(alias, GENERATED_SOLUTIONS);
    }

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

    public <O extends Record> GeneratedSolutions(Table<O> path, ForeignKey<O, GeneratedSolutionsRecord> childPath, InverseForeignKey<O, GeneratedSolutionsRecord> parentPath) {
        super(path, childPath, parentPath, GENERATED_SOLUTIONS);
    }

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

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

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

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

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

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

    @Override
    public UniqueKey<GeneratedSolutionsRecord> getPrimaryKey() {
        return Keys.GENERATED_SOLUTIONS_PKEY;
    }

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

    private transient RecruitmentPath _recruitment;

    /**
     * Get the implicit join path to the <code>metrics.recruitment</code> table.
     */
    public RecruitmentPath recruitment() {
        if (_recruitment == null)
            _recruitment = new RecruitmentPath(this, Keys.GENERATED_SOLUTIONS__FK_GENERATED_SOLUTIONS_RECRUITMENT_ID, null);

        return _recruitment;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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