//
// 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 EmailLog = newEmailLogTable("comms", "email_log", "")

type emailLogTable struct {
	postgres.Table

	// Columns
	ID             postgres.ColumnInteger
	Created        postgres.ColumnTimestamp
	DeliveryStatus postgres.ColumnString
	Destination    postgres.ColumnString
	PublicID       postgres.ColumnString
	SentAt         postgres.ColumnTimestamp
	Source         postgres.ColumnString
	Subject        postgres.ColumnString
	TemplateID     postgres.ColumnInteger
	TemplateData   postgres.ColumnString
	Type           postgres.ColumnString

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

type EmailLogTable struct {
	emailLogTable

	EXCLUDED emailLogTable
}

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

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

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

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

func newEmailLogTable(schemaName, tableName, alias string) *EmailLogTable {
	return &EmailLogTable{
		emailLogTable: newEmailLogTableImpl(schemaName, tableName, alias),
		EXCLUDED:      newEmailLogTableImpl("", "excluded", ""),
	}
}

func newEmailLogTableImpl(schemaName, tableName, alias string) emailLogTable {
	var (
		IDColumn             = postgres.IntegerColumn("id")
		CreatedColumn        = postgres.TimestampColumn("created")
		DeliveryStatusColumn = postgres.StringColumn("delivery_status")
		DestinationColumn    = postgres.StringColumn("destination")
		PublicIDColumn       = postgres.StringColumn("public_id")
		SentAtColumn         = postgres.TimestampColumn("sent_at")
		SourceColumn         = postgres.StringColumn("source")
		SubjectColumn        = postgres.StringColumn("subject")
		TemplateIDColumn     = postgres.IntegerColumn("template_id")
		TemplateDataColumn   = postgres.StringColumn("template_data")
		TypeColumn           = postgres.StringColumn("type")
		allColumns           = postgres.ColumnList{IDColumn, CreatedColumn, DeliveryStatusColumn, DestinationColumn, PublicIDColumn, SentAtColumn, SourceColumn, SubjectColumn, TemplateIDColumn, TemplateDataColumn, TypeColumn}
		mutableColumns       = postgres.ColumnList{CreatedColumn, DeliveryStatusColumn, DestinationColumn, PublicIDColumn, SentAtColumn, SourceColumn, SubjectColumn, TemplateIDColumn, TemplateDataColumn, TypeColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		ID:             IDColumn,
		Created:        CreatedColumn,
		DeliveryStatus: DeliveryStatusColumn,
		Destination:    DestinationColumn,
		PublicID:       PublicIDColumn,
		SentAt:         SentAtColumn,
		Source:         SourceColumn,
		Subject:        SubjectColumn,
		TemplateID:     TemplateIDColumn,
		TemplateData:   TemplateDataColumn,
		Type:           TypeColumn,

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