//
// 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/Gleipnir-Technology/jet/postgres"
)

var Mailer = newMailerTable("comms", "mailer", "")

type mailerTable struct {
	postgres.Table

	// Columns
	AddressID  postgres.ColumnInteger
	Created    postgres.ColumnTimestamp
	ID         postgres.ColumnInteger
	Recipient  postgres.ColumnString
	UUID       postgres.ColumnString
	ExternalID postgres.ColumnString

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

type MailerTable struct {
	mailerTable

	EXCLUDED mailerTable
}

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

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

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

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

func newMailerTable(schemaName, tableName, alias string) *MailerTable {
	return &MailerTable{
		mailerTable: newMailerTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newMailerTableImpl("", "excluded", ""),
	}
}

func newMailerTableImpl(schemaName, tableName, alias string) mailerTable {
	var (
		AddressIDColumn  = postgres.IntegerColumn("address_id")
		CreatedColumn    = postgres.TimestampColumn("created")
		IDColumn         = postgres.IntegerColumn("id")
		RecipientColumn  = postgres.StringColumn("recipient")
		UUIDColumn       = postgres.StringColumn("uuid")
		ExternalIDColumn = postgres.StringColumn("external_id")
		allColumns       = postgres.ColumnList{AddressIDColumn, CreatedColumn, IDColumn, RecipientColumn, UUIDColumn, ExternalIDColumn}
		mutableColumns   = postgres.ColumnList{AddressIDColumn, CreatedColumn, RecipientColumn, UUIDColumn, ExternalIDColumn}
		defaultColumns   = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		AddressID:  AddressIDColumn,
		Created:    CreatedColumn,
		ID:         IDColumn,
		Recipient:  RecipientColumn,
		UUID:       UUIDColumn,
		ExternalID: ExternalIDColumn,

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