//
// 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 MailDeadLetters = newMailDeadLettersTable("backend", "mail_dead_letters", "")

type mailDeadLettersTable struct {
	postgres.Table

	// Columns
	DeadLetterID postgres.ColumnString
	DeliveryID   postgres.ColumnString
	ArchivedAt   postgres.ColumnTimestampz
	Reason       postgres.ColumnString

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

type MailDeadLettersTable struct {
	mailDeadLettersTable

	EXCLUDED mailDeadLettersTable
}

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

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

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

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

func newMailDeadLettersTable(schemaName, tableName, alias string) *MailDeadLettersTable {
	return &MailDeadLettersTable{
		mailDeadLettersTable: newMailDeadLettersTableImpl(schemaName, tableName, alias),
		EXCLUDED:             newMailDeadLettersTableImpl("", "excluded", ""),
	}
}

func newMailDeadLettersTableImpl(schemaName, tableName, alias string) mailDeadLettersTable {
	var (
		DeadLetterIDColumn = postgres.StringColumn("dead_letter_id")
		DeliveryIDColumn   = postgres.StringColumn("delivery_id")
		ArchivedAtColumn   = postgres.TimestampzColumn("archived_at")
		ReasonColumn       = postgres.StringColumn("reason")
		allColumns         = postgres.ColumnList{DeadLetterIDColumn, DeliveryIDColumn, ArchivedAtColumn, ReasonColumn}
		mutableColumns     = postgres.ColumnList{DeliveryIDColumn, ArchivedAtColumn, ReasonColumn}
		defaultColumns     = postgres.ColumnList{ArchivedAtColumn}
	)

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

		//Columns
		DeadLetterID: DeadLetterIDColumn,
		DeliveryID:   DeliveryIDColumn,
		ArchivedAt:   ArchivedAtColumn,
		Reason:       ReasonColumn,

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