//
// 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 UserImages = newUserImagesTable("haystack", "user_images", "")

type userImagesTable struct {
	postgres.Table

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

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserImagesTable struct {
	userImagesTable

	EXCLUDED userImagesTable
}

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

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

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

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

func newUserImagesTable(schemaName, tableName, alias string) *UserImagesTable {
	return &UserImagesTable{
		userImagesTable: newUserImagesTableImpl(schemaName, tableName, alias),
		EXCLUDED:        newUserImagesTableImpl("", "excluded", ""),
	}
}

func newUserImagesTableImpl(schemaName, tableName, alias string) userImagesTable {
	var (
		IDColumn        = postgres.StringColumn("id")
		ImageIDColumn   = postgres.StringColumn("image_id")
		UserIDColumn    = postgres.StringColumn("user_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{IDColumn, ImageIDColumn, UserIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{ImageIDColumn, UserIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:        IDColumn,
		ImageID:   ImageIDColumn,
		UserID:    UserIDColumn,
		CreatedAt: CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
