//
// 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/go-jet/jet/v2/postgres"
)

var Locations = newLocationsTable("haystack", "locations", "")

type locationsTable struct {
	postgres.Table

	// Columns
	ID          postgres.ColumnString
	Name        postgres.ColumnString
	Address     postgres.ColumnString
	Description postgres.ColumnString
	CreatedAt   postgres.ColumnTimestampz

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type LocationsTable struct {
	locationsTable

	EXCLUDED locationsTable
}

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

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

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

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

func newLocationsTable(schemaName, tableName, alias string) *LocationsTable {
	return &LocationsTable{
		locationsTable: newLocationsTableImpl(schemaName, tableName, alias),
		EXCLUDED:       newLocationsTableImpl("", "excluded", ""),
	}
}

func newLocationsTableImpl(schemaName, tableName, alias string) locationsTable {
	var (
		IDColumn          = postgres.StringColumn("id")
		NameColumn        = postgres.StringColumn("name")
		AddressColumn     = postgres.StringColumn("address")
		DescriptionColumn = postgres.StringColumn("description")
		CreatedAtColumn   = postgres.TimestampzColumn("created_at")
		allColumns        = postgres.ColumnList{IDColumn, NameColumn, AddressColumn, DescriptionColumn, CreatedAtColumn}
		mutableColumns    = postgres.ColumnList{NameColumn, AddressColumn, DescriptionColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:          IDColumn,
		Name:        NameColumn,
		Address:     AddressColumn,
		Description: DescriptionColumn,
		CreatedAt:   CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
