//
// 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 ContactPhone = newContactPhoneTable("comms", "contact_phone", "")

type contactPhoneTable struct {
	postgres.Table

	// Columns
	ContactID    postgres.ColumnInteger
	E164         postgres.ColumnString
	IsSubscribed postgres.ColumnBool
	ID           postgres.ColumnInteger

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

type ContactPhoneTable struct {
	contactPhoneTable

	EXCLUDED contactPhoneTable
}

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

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

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

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

func newContactPhoneTable(schemaName, tableName, alias string) *ContactPhoneTable {
	return &ContactPhoneTable{
		contactPhoneTable: newContactPhoneTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newContactPhoneTableImpl("", "excluded", ""),
	}
}

func newContactPhoneTableImpl(schemaName, tableName, alias string) contactPhoneTable {
	var (
		ContactIDColumn    = postgres.IntegerColumn("contact_id")
		E164Column         = postgres.StringColumn("e164")
		IsSubscribedColumn = postgres.BoolColumn("is_subscribed")
		IDColumn           = postgres.IntegerColumn("id")
		allColumns         = postgres.ColumnList{ContactIDColumn, E164Column, IsSubscribedColumn, IDColumn}
		mutableColumns     = postgres.ColumnList{ContactIDColumn, E164Column, IsSubscribedColumn}
		defaultColumns     = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		ContactID:    ContactIDColumn,
		E164:         E164Column,
		IsSubscribed: IsSubscribedColumn,
		ID:           IDColumn,

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