//
// 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 Friendships = newFriendshipsTable("backend", "friendships", "")

type friendshipsTable struct {
	postgres.Table

	// Columns
	RequesterID postgres.ColumnString
	AddresseeID postgres.ColumnString
	Status      postgres.ColumnString
	CreatedAt   postgres.ColumnTimestampz
	RespondedAt postgres.ColumnTimestampz

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

type FriendshipsTable struct {
	friendshipsTable

	EXCLUDED friendshipsTable
}

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

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

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

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

func newFriendshipsTable(schemaName, tableName, alias string) *FriendshipsTable {
	return &FriendshipsTable{
		friendshipsTable: newFriendshipsTableImpl(schemaName, tableName, alias),
		EXCLUDED:         newFriendshipsTableImpl("", "excluded", ""),
	}
}

func newFriendshipsTableImpl(schemaName, tableName, alias string) friendshipsTable {
	var (
		RequesterIDColumn = postgres.StringColumn("requester_id")
		AddresseeIDColumn = postgres.StringColumn("addressee_id")
		StatusColumn      = postgres.StringColumn("status")
		CreatedAtColumn   = postgres.TimestampzColumn("created_at")
		RespondedAtColumn = postgres.TimestampzColumn("responded_at")
		allColumns        = postgres.ColumnList{RequesterIDColumn, AddresseeIDColumn, StatusColumn, CreatedAtColumn, RespondedAtColumn}
		mutableColumns    = postgres.ColumnList{StatusColumn, CreatedAtColumn, RespondedAtColumn}
		defaultColumns    = postgres.ColumnList{StatusColumn, CreatedAtColumn}
	)

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

		//Columns
		RequesterID: RequesterIDColumn,
		AddresseeID: AddresseeIDColumn,
		Status:      StatusColumn,
		CreatedAt:   CreatedAtColumn,
		RespondedAt: RespondedAtColumn,

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