//
// 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 ContactEmail = newContactEmailTable("comms", "contact_email", "")

type contactEmailTable struct {
	postgres.Table

	// Columns
	Address      postgres.ColumnString
	Confirmed    postgres.ColumnBool
	ContactID    postgres.ColumnInteger
	IsSubscribed postgres.ColumnBool
	ID           postgres.ColumnInteger

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

type ContactEmailTable struct {
	contactEmailTable

	EXCLUDED contactEmailTable
}

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

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

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

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

func newContactEmailTable(schemaName, tableName, alias string) *ContactEmailTable {
	return &ContactEmailTable{
		contactEmailTable: newContactEmailTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newContactEmailTableImpl("", "excluded", ""),
	}
}

func newContactEmailTableImpl(schemaName, tableName, alias string) contactEmailTable {
	var (
		AddressColumn      = postgres.StringColumn("address")
		ConfirmedColumn    = postgres.BoolColumn("confirmed")
		ContactIDColumn    = postgres.IntegerColumn("contact_id")
		IsSubscribedColumn = postgres.BoolColumn("is_subscribed")
		IDColumn           = postgres.IntegerColumn("id")
		allColumns         = postgres.ColumnList{AddressColumn, ConfirmedColumn, ContactIDColumn, IsSubscribedColumn, IDColumn}
		mutableColumns     = postgres.ColumnList{AddressColumn, ConfirmedColumn, ContactIDColumn, IsSubscribedColumn}
		defaultColumns     = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Address:      AddressColumn,
		Confirmed:    ConfirmedColumn,
		ContactID:    ContactIDColumn,
		IsSubscribed: IsSubscribedColumn,
		ID:           IDColumn,

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