//
// 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 Site = newSiteTable("public", "site", "")

type siteTable struct {
	postgres.Table

	// Columns
	AddressID      postgres.ColumnInteger
	Created        postgres.ColumnTimestamp
	CreatorID      postgres.ColumnInteger
	FileID         postgres.ColumnInteger
	ID             postgres.ColumnInteger
	Notes          postgres.ColumnString
	OrganizationID postgres.ColumnInteger
	OwnerName      postgres.ColumnString
	OwnerPhoneE164 postgres.ColumnString
	ParcelID       postgres.ColumnInteger
	ResidentOwned  postgres.ColumnBool
	Tags           postgres.ColumnString
	Version        postgres.ColumnInteger

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

type SiteTable struct {
	siteTable

	EXCLUDED siteTable
}

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

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

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

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

func newSiteTable(schemaName, tableName, alias string) *SiteTable {
	return &SiteTable{
		siteTable: newSiteTableImpl(schemaName, tableName, alias),
		EXCLUDED:  newSiteTableImpl("", "excluded", ""),
	}
}

func newSiteTableImpl(schemaName, tableName, alias string) siteTable {
	var (
		AddressIDColumn      = postgres.IntegerColumn("address_id")
		CreatedColumn        = postgres.TimestampColumn("created")
		CreatorIDColumn      = postgres.IntegerColumn("creator_id")
		FileIDColumn         = postgres.IntegerColumn("file_id")
		IDColumn             = postgres.IntegerColumn("id")
		NotesColumn          = postgres.StringColumn("notes")
		OrganizationIDColumn = postgres.IntegerColumn("organization_id")
		OwnerNameColumn      = postgres.StringColumn("owner_name")
		OwnerPhoneE164Column = postgres.StringColumn("owner_phone_e164")
		ParcelIDColumn       = postgres.IntegerColumn("parcel_id")
		ResidentOwnedColumn  = postgres.BoolColumn("resident_owned")
		TagsColumn           = postgres.StringColumn("tags")
		VersionColumn        = postgres.IntegerColumn("version")
		allColumns           = postgres.ColumnList{AddressIDColumn, CreatedColumn, CreatorIDColumn, FileIDColumn, IDColumn, NotesColumn, OrganizationIDColumn, OwnerNameColumn, OwnerPhoneE164Column, ParcelIDColumn, ResidentOwnedColumn, TagsColumn, VersionColumn}
		mutableColumns       = postgres.ColumnList{AddressIDColumn, CreatedColumn, CreatorIDColumn, FileIDColumn, NotesColumn, OrganizationIDColumn, OwnerNameColumn, OwnerPhoneE164Column, ParcelIDColumn, ResidentOwnedColumn, TagsColumn, VersionColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		AddressID:      AddressIDColumn,
		Created:        CreatedColumn,
		CreatorID:      CreatorIDColumn,
		FileID:         FileIDColumn,
		ID:             IDColumn,
		Notes:          NotesColumn,
		OrganizationID: OrganizationIDColumn,
		OwnerName:      OwnerNameColumn,
		OwnerPhoneE164: OwnerPhoneE164Column,
		ParcelID:       ParcelIDColumn,
		ResidentOwned:  ResidentOwnedColumn,
		Tags:           TagsColumn,
		Version:        VersionColumn,

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