//
// 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 Lead = newLeadTable("public", "lead", "")

type leadTable struct {
	postgres.Table

	// Columns
	Created        postgres.ColumnTimestamp
	Creator        postgres.ColumnInteger
	ID             postgres.ColumnInteger
	OrganizationID postgres.ColumnInteger
	SiteID         postgres.ColumnInteger
	Type           postgres.ColumnString

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

type LeadTable struct {
	leadTable

	EXCLUDED leadTable
}

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

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

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

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

func newLeadTable(schemaName, tableName, alias string) *LeadTable {
	return &LeadTable{
		leadTable: newLeadTableImpl(schemaName, tableName, alias),
		EXCLUDED:  newLeadTableImpl("", "excluded", ""),
	}
}

func newLeadTableImpl(schemaName, tableName, alias string) leadTable {
	var (
		CreatedColumn        = postgres.TimestampColumn("created")
		CreatorColumn        = postgres.IntegerColumn("creator")
		IDColumn             = postgres.IntegerColumn("id")
		OrganizationIDColumn = postgres.IntegerColumn("organization_id")
		SiteIDColumn         = postgres.IntegerColumn("site_id")
		TypeColumn           = postgres.StringColumn("type_")
		allColumns           = postgres.ColumnList{CreatedColumn, CreatorColumn, IDColumn, OrganizationIDColumn, SiteIDColumn, TypeColumn}
		mutableColumns       = postgres.ColumnList{CreatedColumn, CreatorColumn, OrganizationIDColumn, SiteIDColumn, TypeColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Created:        CreatedColumn,
		Creator:        CreatorColumn,
		ID:             IDColumn,
		OrganizationID: OrganizationIDColumn,
		SiteID:         SiteIDColumn,
		Type:           TypeColumn,

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