//
// 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 EmailTemplate = newEmailTemplateTable("comms", "email_template", "")

type emailTemplateTable struct {
	postgres.Table

	// Columns
	ContentHTML     postgres.ColumnString
	ContentTxt      postgres.ColumnString
	ContentHashHTML postgres.ColumnString
	ContentHashTxt  postgres.ColumnString
	Created         postgres.ColumnTimestamp
	ID              postgres.ColumnInteger
	Superceded      postgres.ColumnTimestamp
	MessageType     postgres.ColumnString

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

type EmailTemplateTable struct {
	emailTemplateTable

	EXCLUDED emailTemplateTable
}

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

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

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

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

func newEmailTemplateTable(schemaName, tableName, alias string) *EmailTemplateTable {
	return &EmailTemplateTable{
		emailTemplateTable: newEmailTemplateTableImpl(schemaName, tableName, alias),
		EXCLUDED:           newEmailTemplateTableImpl("", "excluded", ""),
	}
}

func newEmailTemplateTableImpl(schemaName, tableName, alias string) emailTemplateTable {
	var (
		ContentHTMLColumn     = postgres.StringColumn("content_html")
		ContentTxtColumn      = postgres.StringColumn("content_txt")
		ContentHashHTMLColumn = postgres.StringColumn("content_hash_html")
		ContentHashTxtColumn  = postgres.StringColumn("content_hash_txt")
		CreatedColumn         = postgres.TimestampColumn("created")
		IDColumn              = postgres.IntegerColumn("id")
		SupercededColumn      = postgres.TimestampColumn("superceded")
		MessageTypeColumn     = postgres.StringColumn("message_type")
		allColumns            = postgres.ColumnList{ContentHTMLColumn, ContentTxtColumn, ContentHashHTMLColumn, ContentHashTxtColumn, CreatedColumn, IDColumn, SupercededColumn, MessageTypeColumn}
		mutableColumns        = postgres.ColumnList{ContentHTMLColumn, ContentTxtColumn, ContentHashHTMLColumn, ContentHashTxtColumn, CreatedColumn, SupercededColumn, MessageTypeColumn}
		defaultColumns        = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		ContentHTML:     ContentHTMLColumn,
		ContentTxt:      ContentTxtColumn,
		ContentHashHTML: ContentHashHTMLColumn,
		ContentHashTxt:  ContentHashTxtColumn,
		Created:         CreatedColumn,
		ID:              IDColumn,
		Superceded:      SupercededColumn,
		MessageType:     MessageTypeColumn,

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