//
// 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 Phone = newPhoneTable("comms", "phone", "")

type phoneTable struct {
	postgres.Table

	// Columns
	E164               postgres.ColumnString
	CanSms             postgres.ColumnBool
	ConfirmedMessageID postgres.ColumnInteger
	StopMessageID      postgres.ColumnInteger

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

type PhoneTable struct {
	phoneTable

	EXCLUDED phoneTable
}

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

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

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

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

func newPhoneTable(schemaName, tableName, alias string) *PhoneTable {
	return &PhoneTable{
		phoneTable: newPhoneTableImpl(schemaName, tableName, alias),
		EXCLUDED:   newPhoneTableImpl("", "excluded", ""),
	}
}

func newPhoneTableImpl(schemaName, tableName, alias string) phoneTable {
	var (
		E164Column               = postgres.StringColumn("e164")
		CanSmsColumn             = postgres.BoolColumn("can_sms")
		ConfirmedMessageIDColumn = postgres.IntegerColumn("confirmed_message_id")
		StopMessageIDColumn      = postgres.IntegerColumn("stop_message_id")
		allColumns               = postgres.ColumnList{E164Column, CanSmsColumn, ConfirmedMessageIDColumn, StopMessageIDColumn}
		mutableColumns           = postgres.ColumnList{CanSmsColumn, ConfirmedMessageIDColumn, StopMessageIDColumn}
		defaultColumns           = postgres.ColumnList{}
	)

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

		//Columns
		E164:               E164Column,
		CanSms:             CanSmsColumn,
		ConfirmedMessageID: ConfirmedMessageIDColumn,
		StopMessageID:      StopMessageIDColumn,

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