//
// 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 MailPayloads = newMailPayloadsTable("backend", "mail_payloads", "")

type mailPayloadsTable struct {
	postgres.Table

	// Columns
	PayloadID   postgres.ColumnString
	ContentType postgres.ColumnString
	Subject     postgres.ColumnString
	Body        postgres.ColumnBytea
	CreatedAt   postgres.ColumnTimestampz

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

type MailPayloadsTable struct {
	mailPayloadsTable

	EXCLUDED mailPayloadsTable
}

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

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

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

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

func newMailPayloadsTable(schemaName, tableName, alias string) *MailPayloadsTable {
	return &MailPayloadsTable{
		mailPayloadsTable: newMailPayloadsTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newMailPayloadsTableImpl("", "excluded", ""),
	}
}

func newMailPayloadsTableImpl(schemaName, tableName, alias string) mailPayloadsTable {
	var (
		PayloadIDColumn   = postgres.StringColumn("payload_id")
		ContentTypeColumn = postgres.StringColumn("content_type")
		SubjectColumn     = postgres.StringColumn("subject")
		BodyColumn        = postgres.ByteaColumn("body")
		CreatedAtColumn   = postgres.TimestampzColumn("created_at")
		allColumns        = postgres.ColumnList{PayloadIDColumn, ContentTypeColumn, SubjectColumn, BodyColumn, CreatedAtColumn}
		mutableColumns    = postgres.ColumnList{ContentTypeColumn, SubjectColumn, BodyColumn, CreatedAtColumn}
		defaultColumns    = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		PayloadID:   PayloadIDColumn,
		ContentType: ContentTypeColumn,
		Subject:     SubjectColumn,
		Body:        BodyColumn,
		CreatedAt:   CreatedAtColumn,

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