//
// 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 Parcel = newParcelTable("public", "parcel", "")

type parcelTable struct {
	postgres.Table

	// Columns
	Apn         postgres.ColumnString
	Description postgres.ColumnString
	ID          postgres.ColumnInteger
	Geometry    postgres.ColumnGeometry

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

type ParcelTable struct {
	parcelTable

	EXCLUDED parcelTable
}

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

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

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

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

func newParcelTable(schemaName, tableName, alias string) *ParcelTable {
	return &ParcelTable{
		parcelTable: newParcelTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newParcelTableImpl("", "excluded", ""),
	}
}

func newParcelTableImpl(schemaName, tableName, alias string) parcelTable {
	var (
		ApnColumn         = postgres.StringColumn("apn")
		DescriptionColumn = postgres.StringColumn("description")
		IDColumn          = postgres.IntegerColumn("id")
		GeometryColumn    = postgres.GeometryColumn("geometry")
		allColumns        = postgres.ColumnList{ApnColumn, DescriptionColumn, IDColumn, GeometryColumn}
		mutableColumns    = postgres.ColumnList{ApnColumn, DescriptionColumn, GeometryColumn}
		defaultColumns    = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Apn:         ApnColumn,
		Description: DescriptionColumn,
		ID:          IDColumn,
		Geometry:    GeometryColumn,

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