//
// 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 LayerField = newLayerFieldTable("arcgis", "layer_field", "")

type layerFieldTable struct {
	postgres.Table

	// Columns
	LayerFeatureServiceItemID postgres.ColumnString
	LayerIndex                postgres.ColumnInteger
	Name                      postgres.ColumnString
	Type                      postgres.ColumnString

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

type LayerFieldTable struct {
	layerFieldTable

	EXCLUDED layerFieldTable
}

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

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

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

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

func newLayerFieldTable(schemaName, tableName, alias string) *LayerFieldTable {
	return &LayerFieldTable{
		layerFieldTable: newLayerFieldTableImpl(schemaName, tableName, alias),
		EXCLUDED:        newLayerFieldTableImpl("", "excluded", ""),
	}
}

func newLayerFieldTableImpl(schemaName, tableName, alias string) layerFieldTable {
	var (
		LayerFeatureServiceItemIDColumn = postgres.StringColumn("layer_feature_service_item_id")
		LayerIndexColumn                = postgres.IntegerColumn("layer_index")
		NameColumn                      = postgres.StringColumn("name")
		TypeColumn                      = postgres.StringColumn("type_")
		allColumns                      = postgres.ColumnList{LayerFeatureServiceItemIDColumn, LayerIndexColumn, NameColumn, TypeColumn}
		mutableColumns                  = postgres.ColumnList{TypeColumn}
		defaultColumns                  = postgres.ColumnList{}
	)

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

		//Columns
		LayerFeatureServiceItemID: LayerFeatureServiceItemIDColumn,
		LayerIndex:                LayerIndexColumn,
		Name:                      NameColumn,
		Type:                      TypeColumn,

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