//
// 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/go-jet/jet/v2/postgres"
)

var LimitActive = newLimitActiveTable("backend", "limit_active", "")

type limitActiveTable struct {
	postgres.Table

	// Columns
	UserID    postgres.ColumnString
	LimitCode postgres.ColumnString
	RecordID  postgres.ColumnString
	Value     postgres.ColumnInteger

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

type LimitActiveTable struct {
	limitActiveTable

	EXCLUDED limitActiveTable
}

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

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

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

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

func newLimitActiveTable(schemaName, tableName, alias string) *LimitActiveTable {
	return &LimitActiveTable{
		limitActiveTable: newLimitActiveTableImpl(schemaName, tableName, alias),
		EXCLUDED:         newLimitActiveTableImpl("", "excluded", ""),
	}
}

func newLimitActiveTableImpl(schemaName, tableName, alias string) limitActiveTable {
	var (
		UserIDColumn    = postgres.StringColumn("user_id")
		LimitCodeColumn = postgres.StringColumn("limit_code")
		RecordIDColumn  = postgres.StringColumn("record_id")
		ValueColumn     = postgres.IntegerColumn("value")
		allColumns      = postgres.ColumnList{UserIDColumn, LimitCodeColumn, RecordIDColumn, ValueColumn}
		mutableColumns  = postgres.ColumnList{RecordIDColumn, ValueColumn}
		defaultColumns  = postgres.ColumnList{}
	)

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

		//Columns
		UserID:    UserIDColumn,
		LimitCode: LimitCodeColumn,
		RecordID:  RecordIDColumn,
		Value:     ValueColumn,

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