//
// 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 Feature = newFeatureTable("public", "feature", "")

type featureTable struct {
	postgres.Table

	// Columns
	Created        postgres.ColumnTimestamp
	CreatorID      postgres.ColumnInteger
	ID             postgres.ColumnInteger
	OrganizationID postgres.ColumnInteger
	SiteID         postgres.ColumnInteger
	Location       postgres.ColumnGeometry

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

type FeatureTable struct {
	featureTable

	EXCLUDED featureTable
}

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

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

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

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

func newFeatureTable(schemaName, tableName, alias string) *FeatureTable {
	return &FeatureTable{
		featureTable: newFeatureTableImpl(schemaName, tableName, alias),
		EXCLUDED:     newFeatureTableImpl("", "excluded", ""),
	}
}

func newFeatureTableImpl(schemaName, tableName, alias string) featureTable {
	var (
		CreatedColumn        = postgres.TimestampColumn("created")
		CreatorIDColumn      = postgres.IntegerColumn("creator_id")
		IDColumn             = postgres.IntegerColumn("id")
		OrganizationIDColumn = postgres.IntegerColumn("organization_id")
		SiteIDColumn         = postgres.IntegerColumn("site_id")
		LocationColumn       = postgres.GeometryColumn("location")
		allColumns           = postgres.ColumnList{CreatedColumn, CreatorIDColumn, IDColumn, OrganizationIDColumn, SiteIDColumn, LocationColumn}
		mutableColumns       = postgres.ColumnList{CreatedColumn, CreatorIDColumn, OrganizationIDColumn, SiteIDColumn, LocationColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Created:        CreatedColumn,
		CreatorID:      CreatorIDColumn,
		ID:             IDColumn,
		OrganizationID: OrganizationIDColumn,
		SiteID:         SiteIDColumn,
		Location:       LocationColumn,

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