//
// Code generated by go-jet DO NOT EDIT.
//
// WARNING: Changes to this file may cause incorrect behavior
// and will be lost if the code is regenerated
//

package table

import (
	"github.com/Gleipnir-Technology/jet/postgres"
)

var UserPrivilege = newUserPrivilegeTable("arcgis", "user_privilege", "")

type userPrivilegeTable struct {
	postgres.Table

	// Columns
	UserID    postgres.ColumnString
	Privilege postgres.ColumnString

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
	DefaultColumns postgres.ColumnList
}

type UserPrivilegeTable struct {
	userPrivilegeTable

	EXCLUDED userPrivilegeTable
}

// AS creates new UserPrivilegeTable with assigned alias
func (a UserPrivilegeTable) AS(alias string) *UserPrivilegeTable {
	return newUserPrivilegeTable(a.SchemaName(), a.TableName(), alias)
}

// Schema creates new UserPrivilegeTable with assigned schema name
func (a UserPrivilegeTable) FromSchema(schemaName string) *UserPrivilegeTable {
	return newUserPrivilegeTable(schemaName, a.TableName(), a.Alias())
}

// WithPrefix creates new UserPrivilegeTable with assigned table prefix
func (a UserPrivilegeTable) WithPrefix(prefix string) *UserPrivilegeTable {
	return newUserPrivilegeTable(a.SchemaName(), prefix+a.TableName(), a.TableName())
}

// WithSuffix creates new UserPrivilegeTable with assigned table suffix
func (a UserPrivilegeTable) WithSuffix(suffix string) *UserPrivilegeTable {
	return newUserPrivilegeTable(a.SchemaName(), a.TableName()+suffix, a.TableName())
}

func newUserPrivilegeTable(schemaName, tableName, alias string) *UserPrivilegeTable {
	return &UserPrivilegeTable{
		userPrivilegeTable: newUserPrivilegeTableImpl(schemaName, tableName, alias),
		EXCLUDED:           newUserPrivilegeTableImpl("", "excluded", ""),
	}
}

func newUserPrivilegeTableImpl(schemaName, tableName, alias string) userPrivilegeTable {
	var (
		UserIDColumn    = postgres.StringColumn("user_id")
		PrivilegeColumn = postgres.StringColumn("privilege")
		allColumns      = postgres.ColumnList{UserIDColumn, PrivilegeColumn}
		mutableColumns  = postgres.ColumnList{}
		defaultColumns  = postgres.ColumnList{}
	)

	return userPrivilegeTable{
		Table: postgres.NewTable(schemaName, tableName, alias, allColumns...),

		//Columns
		UserID:    UserIDColumn,
		Privilege: PrivilegeColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
		DefaultColumns: defaultColumns,
	}
}
