//
// 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 PaymentEvents = newPaymentEventsTable("payments", "payment_events", "")

type paymentEventsTable struct {
	postgres.Table

	// Columns
	EventID      postgres.ColumnString
	AccountID    postgres.ColumnString
	OrderID      postgres.ColumnString
	Type         postgres.ColumnString
	Payload      postgres.ColumnString
	CreatedAt    postgres.ColumnTimestampz
	DispatchedAt postgres.ColumnTimestampz

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

type PaymentEventsTable struct {
	paymentEventsTable

	EXCLUDED paymentEventsTable
}

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

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

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

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

func newPaymentEventsTable(schemaName, tableName, alias string) *PaymentEventsTable {
	return &PaymentEventsTable{
		paymentEventsTable: newPaymentEventsTableImpl(schemaName, tableName, alias),
		EXCLUDED:           newPaymentEventsTableImpl("", "excluded", ""),
	}
}

func newPaymentEventsTableImpl(schemaName, tableName, alias string) paymentEventsTable {
	var (
		EventIDColumn      = postgres.StringColumn("event_id")
		AccountIDColumn    = postgres.StringColumn("account_id")
		OrderIDColumn      = postgres.StringColumn("order_id")
		TypeColumn         = postgres.StringColumn("type")
		PayloadColumn      = postgres.StringColumn("payload")
		CreatedAtColumn    = postgres.TimestampzColumn("created_at")
		DispatchedAtColumn = postgres.TimestampzColumn("dispatched_at")
		allColumns         = postgres.ColumnList{EventIDColumn, AccountIDColumn, OrderIDColumn, TypeColumn, PayloadColumn, CreatedAtColumn, DispatchedAtColumn}
		mutableColumns     = postgres.ColumnList{AccountIDColumn, OrderIDColumn, TypeColumn, PayloadColumn, CreatedAtColumn, DispatchedAtColumn}
		defaultColumns     = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		EventID:      EventIDColumn,
		AccountID:    AccountIDColumn,
		OrderID:      OrderIDColumn,
		Type:         TypeColumn,
		Payload:      PayloadColumn,
		CreatedAt:    CreatedAtColumn,
		DispatchedAt: DispatchedAtColumn,

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