//
// 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 UserLocations = newUserLocationsTable("haystack", "user_locations", "")

type userLocationsTable struct {
	postgres.Table

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

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserLocationsTable struct {
	userLocationsTable

	EXCLUDED userLocationsTable
}

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

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

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

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

func newUserLocationsTable(schemaName, tableName, alias string) *UserLocationsTable {
	return &UserLocationsTable{
		userLocationsTable: newUserLocationsTableImpl(schemaName, tableName, alias),
		EXCLUDED:           newUserLocationsTableImpl("", "excluded", ""),
	}
}

func newUserLocationsTableImpl(schemaName, tableName, alias string) userLocationsTable {
	var (
		IDColumn         = postgres.StringColumn("id")
		LocationIDColumn = postgres.StringColumn("location_id")
		UserIDColumn     = postgres.StringColumn("user_id")
		CreatedAtColumn  = postgres.TimestampzColumn("created_at")
		allColumns       = postgres.ColumnList{IDColumn, LocationIDColumn, UserIDColumn, CreatedAtColumn}
		mutableColumns   = postgres.ColumnList{LocationIDColumn, UserIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:         IDColumn,
		LocationID: LocationIDColumn,
		UserID:     UserIDColumn,
		CreatedAt:  CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
