//
// 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 MailRecipients = newMailRecipientsTable("backend", "mail_recipients", "")

type mailRecipientsTable struct {
	postgres.Table

	// Columns
	RecipientID postgres.ColumnString
	DeliveryID  postgres.ColumnString
	Address     postgres.ColumnString
	Kind        postgres.ColumnString

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

type MailRecipientsTable struct {
	mailRecipientsTable

	EXCLUDED mailRecipientsTable
}

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

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

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

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

func newMailRecipientsTable(schemaName, tableName, alias string) *MailRecipientsTable {
	return &MailRecipientsTable{
		mailRecipientsTable: newMailRecipientsTableImpl(schemaName, tableName, alias),
		EXCLUDED:            newMailRecipientsTableImpl("", "excluded", ""),
	}
}

func newMailRecipientsTableImpl(schemaName, tableName, alias string) mailRecipientsTable {
	var (
		RecipientIDColumn = postgres.StringColumn("recipient_id")
		DeliveryIDColumn  = postgres.StringColumn("delivery_id")
		AddressColumn     = postgres.StringColumn("address")
		KindColumn        = postgres.StringColumn("kind")
		allColumns        = postgres.ColumnList{RecipientIDColumn, DeliveryIDColumn, AddressColumn, KindColumn}
		mutableColumns    = postgres.ColumnList{DeliveryIDColumn, AddressColumn, KindColumn}
		defaultColumns    = postgres.ColumnList{}
	)

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

		//Columns
		RecipientID: RecipientIDColumn,
		DeliveryID:  DeliveryIDColumn,
		Address:     AddressColumn,
		Kind:        KindColumn,

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