//
// 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 FriendCodes = newFriendCodesTable("backend", "friend_codes", "")

type friendCodesTable struct {
	postgres.Table

	// Columns
	CodeID     postgres.ColumnString
	AccountID  postgres.ColumnString
	CodeHash   postgres.ColumnString
	ExpiresAt  postgres.ColumnTimestampz
	ConsumedAt postgres.ColumnTimestampz
	CreatedAt  postgres.ColumnTimestampz

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

type FriendCodesTable struct {
	friendCodesTable

	EXCLUDED friendCodesTable
}

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

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

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

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

func newFriendCodesTable(schemaName, tableName, alias string) *FriendCodesTable {
	return &FriendCodesTable{
		friendCodesTable: newFriendCodesTableImpl(schemaName, tableName, alias),
		EXCLUDED:         newFriendCodesTableImpl("", "excluded", ""),
	}
}

func newFriendCodesTableImpl(schemaName, tableName, alias string) friendCodesTable {
	var (
		CodeIDColumn     = postgres.StringColumn("code_id")
		AccountIDColumn  = postgres.StringColumn("account_id")
		CodeHashColumn   = postgres.StringColumn("code_hash")
		ExpiresAtColumn  = postgres.TimestampzColumn("expires_at")
		ConsumedAtColumn = postgres.TimestampzColumn("consumed_at")
		CreatedAtColumn  = postgres.TimestampzColumn("created_at")
		allColumns       = postgres.ColumnList{CodeIDColumn, AccountIDColumn, CodeHashColumn, ExpiresAtColumn, ConsumedAtColumn, CreatedAtColumn}
		mutableColumns   = postgres.ColumnList{AccountIDColumn, CodeHashColumn, ExpiresAtColumn, ConsumedAtColumn, CreatedAtColumn}
		defaultColumns   = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		CodeID:     CodeIDColumn,
		AccountID:  AccountIDColumn,
		CodeHash:   CodeHashColumn,
		ExpiresAt:  ExpiresAtColumn,
		ConsumedAt: ConsumedAtColumn,
		CreatedAt:  CreatedAtColumn,

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