/*
 * 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.SysRoleResourceRecord;

import org.jooq.Field;
import org.jooq.ForeignKey;
import org.jooq.Function3;
import org.jooq.Name;
import org.jooq.Record;
import org.jooq.Records;
import org.jooq.Row3;
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 SysRoleResource extends TableImpl<SysRoleResourceRecord> {

    private static final long serialVersionUID = 1L;

    /**
     * The reference instance of <code>yx.sys_role_resource</code>
     */
    public static final SysRoleResource SYS_ROLE_RESOURCE = new SysRoleResource();

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

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

    /**
     * The column <code>yx.sys_role_resource.roleid</code>.
     */
    public final TableField<SysRoleResourceRecord, String> ROLEID = createField(DSL.name("roleid"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    /**
     * The column <code>yx.sys_role_resource.resid</code>.
     */
    public final TableField<SysRoleResourceRecord, String> RESID = createField(DSL.name("resid"), SQLDataType.VARCHAR(20).nullable(false), this, "");

    private SysRoleResource(Name alias, Table<SysRoleResourceRecord> aliased) {
        this(alias, aliased, null);
    }

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

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

    /**
     * Create an aliased <code>yx.sys_role_resource</code> table reference
     */
    public SysRoleResource(Name alias) {
        this(alias, SYS_ROLE_RESOURCE);
    }

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

    public <O extends Record> SysRoleResource(Table<O> child, ForeignKey<O, SysRoleResourceRecord> key) {
        super(child, key, SYS_ROLE_RESOURCE);
    }

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

    @Override
    public UniqueKey<SysRoleResourceRecord> getPrimaryKey() {
        return Keys.KEY_SYS_ROLE_RESOURCE_PRIMARY;
    }

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

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

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

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

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

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

    // -------------------------------------------------------------------------
    // Row3 type methods
    // -------------------------------------------------------------------------

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

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

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