//
// 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 UserContacts = newUserContactsTable("haystack", "user_contacts", "")

type userContactsTable struct {
	postgres.Table

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

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserContactsTable struct {
	userContactsTable

	EXCLUDED userContactsTable
}

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

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

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

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

func newUserContactsTable(schemaName, tableName, alias string) *UserContactsTable {
	return &UserContactsTable{
		userContactsTable: newUserContactsTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newUserContactsTableImpl("", "excluded", ""),
	}
}

func newUserContactsTableImpl(schemaName, tableName, alias string) userContactsTable {
	var (
		IDColumn        = postgres.StringColumn("id")
		UserIDColumn    = postgres.StringColumn("user_id")
		ContactIDColumn = postgres.StringColumn("contact_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{IDColumn, UserIDColumn, ContactIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{UserIDColumn, ContactIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:        IDColumn,
		UserID:    UserIDColumn,
		ContactID: ContactIDColumn,
		CreatedAt: CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
