//
// 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 UserEvents = newUserEventsTable("haystack", "user_events", "")

type userEventsTable struct {
	postgres.Table

	// Columns
	ID        postgres.ColumnString
	EventID   postgres.ColumnString
	UserID    postgres.ColumnString
	CreatedAt postgres.ColumnTimestampz

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserEventsTable struct {
	userEventsTable

	EXCLUDED userEventsTable
}

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

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

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

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

func newUserEventsTable(schemaName, tableName, alias string) *UserEventsTable {
	return &UserEventsTable{
		userEventsTable: newUserEventsTableImpl(schemaName, tableName, alias),
		EXCLUDED:        newUserEventsTableImpl("", "excluded", ""),
	}
}

func newUserEventsTableImpl(schemaName, tableName, alias string) userEventsTable {
	var (
		IDColumn        = postgres.StringColumn("id")
		EventIDColumn   = postgres.StringColumn("event_id")
		UserIDColumn    = postgres.StringColumn("user_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{IDColumn, EventIDColumn, UserIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{EventIDColumn, UserIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:        IDColumn,
		EventID:   EventIDColumn,
		UserID:    UserIDColumn,
		CreatedAt: CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
