//
// 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 ChatMessages = newChatMessagesTable("backend", "chat_messages", "")

type chatMessagesTable struct {
	postgres.Table

	// Columns
	MessageID   postgres.ColumnString
	GameID      postgres.ColumnString
	SenderID    postgres.ColumnString
	Kind        postgres.ColumnString
	Body        postgres.ColumnString
	SenderIP    postgres.ColumnString
	CreatedAt   postgres.ColumnTimestampz
	UnreadSeats postgres.ColumnInteger

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

type ChatMessagesTable struct {
	chatMessagesTable

	EXCLUDED chatMessagesTable
}

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

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

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

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

func newChatMessagesTable(schemaName, tableName, alias string) *ChatMessagesTable {
	return &ChatMessagesTable{
		chatMessagesTable: newChatMessagesTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newChatMessagesTableImpl("", "excluded", ""),
	}
}

func newChatMessagesTableImpl(schemaName, tableName, alias string) chatMessagesTable {
	var (
		MessageIDColumn   = postgres.StringColumn("message_id")
		GameIDColumn      = postgres.StringColumn("game_id")
		SenderIDColumn    = postgres.StringColumn("sender_id")
		KindColumn        = postgres.StringColumn("kind")
		BodyColumn        = postgres.StringColumn("body")
		SenderIPColumn    = postgres.StringColumn("sender_ip")
		CreatedAtColumn   = postgres.TimestampzColumn("created_at")
		UnreadSeatsColumn = postgres.IntegerColumn("unread_seats")
		allColumns        = postgres.ColumnList{MessageIDColumn, GameIDColumn, SenderIDColumn, KindColumn, BodyColumn, SenderIPColumn, CreatedAtColumn, UnreadSeatsColumn}
		mutableColumns    = postgres.ColumnList{GameIDColumn, SenderIDColumn, KindColumn, BodyColumn, SenderIPColumn, CreatedAtColumn, UnreadSeatsColumn}
		defaultColumns    = postgres.ColumnList{KindColumn, BodyColumn, CreatedAtColumn, UnreadSeatsColumn}
	)

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

		//Columns
		MessageID:   MessageIDColumn,
		GameID:      GameIDColumn,
		SenderID:    SenderIDColumn,
		Kind:        KindColumn,
		Body:        BodyColumn,
		SenderIP:    SenderIPColumn,
		CreatedAt:   CreatedAtColumn,
		UnreadSeats: UnreadSeatsColumn,

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