//
// 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 Contact = newContactTable("comms", "contact", "")

type contactTable struct {
	postgres.Table

	// Columns
	Created        postgres.ColumnTimestamp
	ID             postgres.ColumnInteger
	Name           postgres.ColumnString
	OrganizationID postgres.ColumnInteger

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

type ContactTable struct {
	contactTable

	EXCLUDED contactTable
}

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

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

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

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

func newContactTable(schemaName, tableName, alias string) *ContactTable {
	return &ContactTable{
		contactTable: newContactTableImpl(schemaName, tableName, alias),
		EXCLUDED:     newContactTableImpl("", "excluded", ""),
	}
}

func newContactTableImpl(schemaName, tableName, alias string) contactTable {
	var (
		CreatedColumn        = postgres.TimestampColumn("created")
		IDColumn             = postgres.IntegerColumn("id")
		NameColumn           = postgres.StringColumn("name")
		OrganizationIDColumn = postgres.IntegerColumn("organization_id")
		allColumns           = postgres.ColumnList{CreatedColumn, IDColumn, NameColumn, OrganizationIDColumn}
		mutableColumns       = postgres.ColumnList{CreatedColumn, NameColumn, OrganizationIDColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Created:        CreatedColumn,
		ID:             IDColumn,
		Name:           NameColumn,
		OrganizationID: OrganizationIDColumn,

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