//
// 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 MailAttempts = newMailAttemptsTable("backend", "mail_attempts", "")

type mailAttemptsTable struct {
	postgres.Table

	// Columns
	AttemptID  postgres.ColumnString
	DeliveryID postgres.ColumnString
	AttemptNo  postgres.ColumnInteger
	StartedAt  postgres.ColumnTimestampz
	FinishedAt postgres.ColumnTimestampz
	Outcome    postgres.ColumnString
	Error      postgres.ColumnString

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

type MailAttemptsTable struct {
	mailAttemptsTable

	EXCLUDED mailAttemptsTable
}

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

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

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

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

func newMailAttemptsTable(schemaName, tableName, alias string) *MailAttemptsTable {
	return &MailAttemptsTable{
		mailAttemptsTable: newMailAttemptsTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newMailAttemptsTableImpl("", "excluded", ""),
	}
}

func newMailAttemptsTableImpl(schemaName, tableName, alias string) mailAttemptsTable {
	var (
		AttemptIDColumn  = postgres.StringColumn("attempt_id")
		DeliveryIDColumn = postgres.StringColumn("delivery_id")
		AttemptNoColumn  = postgres.IntegerColumn("attempt_no")
		StartedAtColumn  = postgres.TimestampzColumn("started_at")
		FinishedAtColumn = postgres.TimestampzColumn("finished_at")
		OutcomeColumn    = postgres.StringColumn("outcome")
		ErrorColumn      = postgres.StringColumn("error")
		allColumns       = postgres.ColumnList{AttemptIDColumn, DeliveryIDColumn, AttemptNoColumn, StartedAtColumn, FinishedAtColumn, OutcomeColumn, ErrorColumn}
		mutableColumns   = postgres.ColumnList{DeliveryIDColumn, AttemptNoColumn, StartedAtColumn, FinishedAtColumn, OutcomeColumn, ErrorColumn}
		defaultColumns   = postgres.ColumnList{StartedAtColumn, ErrorColumn}
	)

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

		//Columns
		AttemptID:  AttemptIDColumn,
		DeliveryID: DeliveryIDColumn,
		AttemptNo:  AttemptNoColumn,
		StartedAt:  StartedAtColumn,
		FinishedAt: FinishedAtColumn,
		Outcome:    OutcomeColumn,
		Error:      ErrorColumn,

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