//
// 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 EmailContact = newEmailContactTable("comms", "email_contact", "")

type emailContactTable struct {
	postgres.Table

	// Columns
	Address      postgres.ColumnString
	Confirmed    postgres.ColumnBool
	IsSubscribed postgres.ColumnBool
	PublicID     postgres.ColumnString

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

type EmailContactTable struct {
	emailContactTable

	EXCLUDED emailContactTable
}

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

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

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

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

func newEmailContactTable(schemaName, tableName, alias string) *EmailContactTable {
	return &EmailContactTable{
		emailContactTable: newEmailContactTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newEmailContactTableImpl("", "excluded", ""),
	}
}

func newEmailContactTableImpl(schemaName, tableName, alias string) emailContactTable {
	var (
		AddressColumn      = postgres.StringColumn("address")
		ConfirmedColumn    = postgres.BoolColumn("confirmed")
		IsSubscribedColumn = postgres.BoolColumn("is_subscribed")
		PublicIDColumn     = postgres.StringColumn("public_id")
		allColumns         = postgres.ColumnList{AddressColumn, ConfirmedColumn, IsSubscribedColumn, PublicIDColumn}
		mutableColumns     = postgres.ColumnList{ConfirmedColumn, IsSubscribedColumn, PublicIDColumn}
		defaultColumns     = postgres.ColumnList{}
	)

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

		//Columns
		Address:      AddressColumn,
		Confirmed:    ConfirmedColumn,
		IsSubscribed: IsSubscribedColumn,
		PublicID:     PublicIDColumn,

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