//
// 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 MailDeliveries = newMailDeliveriesTable("backend", "mail_deliveries", "")

type mailDeliveriesTable struct {
	postgres.Table

	// Columns
	DeliveryID     postgres.ColumnString
	TemplateID     postgres.ColumnString
	IdempotencyKey postgres.ColumnString
	Status         postgres.ColumnString
	Attempts       postgres.ColumnInteger
	NextAttemptAt  postgres.ColumnTimestampz
	PayloadID      postgres.ColumnString
	LastError      postgres.ColumnString
	CreatedAt      postgres.ColumnTimestampz
	UpdatedAt      postgres.ColumnTimestampz
	SentAt         postgres.ColumnTimestampz
	DeadLetteredAt postgres.ColumnTimestampz

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

type MailDeliveriesTable struct {
	mailDeliveriesTable

	EXCLUDED mailDeliveriesTable
}

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

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

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

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

func newMailDeliveriesTable(schemaName, tableName, alias string) *MailDeliveriesTable {
	return &MailDeliveriesTable{
		mailDeliveriesTable: newMailDeliveriesTableImpl(schemaName, tableName, alias),
		EXCLUDED:            newMailDeliveriesTableImpl("", "excluded", ""),
	}
}

func newMailDeliveriesTableImpl(schemaName, tableName, alias string) mailDeliveriesTable {
	var (
		DeliveryIDColumn     = postgres.StringColumn("delivery_id")
		TemplateIDColumn     = postgres.StringColumn("template_id")
		IdempotencyKeyColumn = postgres.StringColumn("idempotency_key")
		StatusColumn         = postgres.StringColumn("status")
		AttemptsColumn       = postgres.IntegerColumn("attempts")
		NextAttemptAtColumn  = postgres.TimestampzColumn("next_attempt_at")
		PayloadIDColumn      = postgres.StringColumn("payload_id")
		LastErrorColumn      = postgres.StringColumn("last_error")
		CreatedAtColumn      = postgres.TimestampzColumn("created_at")
		UpdatedAtColumn      = postgres.TimestampzColumn("updated_at")
		SentAtColumn         = postgres.TimestampzColumn("sent_at")
		DeadLetteredAtColumn = postgres.TimestampzColumn("dead_lettered_at")
		allColumns           = postgres.ColumnList{DeliveryIDColumn, TemplateIDColumn, IdempotencyKeyColumn, StatusColumn, AttemptsColumn, NextAttemptAtColumn, PayloadIDColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn, SentAtColumn, DeadLetteredAtColumn}
		mutableColumns       = postgres.ColumnList{TemplateIDColumn, IdempotencyKeyColumn, StatusColumn, AttemptsColumn, NextAttemptAtColumn, PayloadIDColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn, SentAtColumn, DeadLetteredAtColumn}
		defaultColumns       = postgres.ColumnList{AttemptsColumn, LastErrorColumn, CreatedAtColumn, UpdatedAtColumn}
	)

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

		//Columns
		DeliveryID:     DeliveryIDColumn,
		TemplateID:     TemplateIDColumn,
		IdempotencyKey: IdempotencyKeyColumn,
		Status:         StatusColumn,
		Attempts:       AttemptsColumn,
		NextAttemptAt:  NextAttemptAtColumn,
		PayloadID:      PayloadIDColumn,
		LastError:      LastErrorColumn,
		CreatedAt:      CreatedAtColumn,
		UpdatedAt:      UpdatedAtColumn,
		SentAt:         SentAtColumn,
		DeadLetteredAt: DeadLetteredAtColumn,

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