/*
 * This file is generated by jOOQ.
 */
package jj.tech.paolu.repository.jooq.tables;


import java.util.function.Function;

import jj.tech.paolu.repository.jooq.Keys;
import jj.tech.paolu.repository.jooq.Yx;
import jj.tech.paolu.repository.jooq.tables.records.SysMenuRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function10;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row10;
import org.jooq.Schema;
import org.jooq.SelectField;
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;


/**
 * This class is generated by jOOQ.
 */
@SuppressWarnings({ "all", "unchecked", "rawtypes", "this-escape" })
public class SysMenu extends TableImpl<SysMenuRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_menu</code>
     */
    public static final SysMenu SYS_MENU = new SysMenu();

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

    /**
     * The column <code>yx.sys_menu.id</code>.
     */
    public final TableField<SysMenuRecord, String> ID = createField(DSL.name("id"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_menu.parent_id</code>.
     */
    public final TableField<SysMenuRecord, String> PARENT_ID = createField(DSL.name("parent_id"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_menu.level</code>.
     */
    public final TableField<SysMenuRecord, Integer> LEVEL = createField(DSL.name("level"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.INTEGER)), this, "");

    /**
     * The column <code>yx.sys_menu.name</code>.
     */
    public final TableField<SysMenuRecord, String> NAME = createField(DSL.name("name"), SQLDataType.VARCHAR(50).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_menu.types</code>. menu,url
     */
    public final TableField<SysMenuRecord, String> TYPES = createField(DSL.name("types"), SQLDataType.VARCHAR(50).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "menu,url");

    /**
     * The column <code>yx.sys_menu.url</code>.
     */
    public final TableField<SysMenuRecord, String> URL = createField(DSL.name("url"), SQLDataType.VARCHAR(200).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_menu.icon</code>.
     */
    public final TableField<SysMenuRecord, String> ICON = createField(DSL.name("icon"), SQLDataType.VARCHAR(100).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_menu.is_open</code>.
     */
    public final TableField<SysMenuRecord, Integer> IS_OPEN = createField(DSL.name("is_open"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");

    /**
     * The column <code>yx.sys_menu.description</code>.
     */
    public final TableField<SysMenuRecord, String> DESCRIPTION = createField(DSL.name("description"), SQLDataType.VARCHAR(200).defaultValue(DSL.field(DSL.raw("NULL"), SQLDataType.VARCHAR)), this, "");

    /**
     * The column <code>yx.sys_menu.sort</code>.
     */
    public final TableField<SysMenuRecord, Integer> SORT = createField(DSL.name("sort"), SQLDataType.INTEGER.defaultValue(DSL.field(DSL.raw("0"), SQLDataType.INTEGER)), this, "");

    private SysMenu(Name alias, Table<SysMenuRecord> aliased) {
        this(alias, aliased, null);
    }

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

    /**
     * Create an aliased <code>yx.sys_menu</code> table reference
     */
    public SysMenu(String alias) {
        this(DSL.name(alias), SYS_MENU);
    }

    /**
     * Create an aliased <code>yx.sys_menu</code> table reference
     */
    public SysMenu(Name alias) {
        this(alias, SYS_MENU);
    }

    /**
     * Create a <code>yx.sys_menu</code> table reference
     */
    public SysMenu() {
        this(DSL.name("sys_menu"), null);
    }

    public <O extends Record> SysMenu(Table<O> child, ForeignKey<O, SysMenuRecord> key) {
        super(child, key, SYS_MENU);
    }

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

    @Override
    public UniqueKey<SysMenuRecord> getPrimaryKey() {
        return Keys.KEY_SYS_MENU_PRIMARY;
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row10 type methods
    // -------------------------------------------------------------------------

    @Override
    public Row10<String, String, Integer, String, String, String, String, Integer, String, Integer> fieldsRow() {
        return (Row10) super.fieldsRow();
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Function)}.
     */
    public <U> SelectField<U> mapping(Function10<? super String, ? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super String, ? super Integer, ? extends U> from) {
        return convertFrom(Records.mapping(from));
    }

    /**
     * Convenience mapping calling {@link SelectField#convertFrom(Class,
     * Function)}.
     */
    public <U> SelectField<U> mapping(Class<U> toType, Function10<? super String, ? super String, ? super Integer, ? super String, ? super String, ? super String, ? super String, ? super Integer, ? super String, ? super Integer, ? extends U> from) {
        return convertFrom(toType, Records.mapping(from));
    }
}
