//
// 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 Events = newEventsTable("haystack", "events", "")

type eventsTable struct {
	postgres.Table

	// Columns
	ID            postgres.ColumnString
	Name          postgres.ColumnString
	Description   postgres.ColumnString
	StartDateTime postgres.ColumnTimestamp
	EndDateTime   postgres.ColumnTimestamp
	LocationID    postgres.ColumnString
	OrganizerID   postgres.ColumnString
	CreatedAt     postgres.ColumnTimestampz

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type EventsTable struct {
	eventsTable

	EXCLUDED eventsTable
}

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

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

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

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

func newEventsTable(schemaName, tableName, alias string) *EventsTable {
	return &EventsTable{
		eventsTable: newEventsTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newEventsTableImpl("", "excluded", ""),
	}
}

func newEventsTableImpl(schemaName, tableName, alias string) eventsTable {
	var (
		IDColumn            = postgres.StringColumn("id")
		NameColumn          = postgres.StringColumn("name")
		DescriptionColumn   = postgres.StringColumn("description")
		StartDateTimeColumn = postgres.TimestampColumn("start_date_time")
		EndDateTimeColumn   = postgres.TimestampColumn("end_date_time")
		LocationIDColumn    = postgres.StringColumn("location_id")
		OrganizerIDColumn   = postgres.StringColumn("organizer_id")
		CreatedAtColumn     = postgres.TimestampzColumn("created_at")
		allColumns          = postgres.ColumnList{IDColumn, NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn, CreatedAtColumn}
		mutableColumns      = postgres.ColumnList{NameColumn, DescriptionColumn, StartDateTimeColumn, EndDateTimeColumn, LocationIDColumn, OrganizerIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:            IDColumn,
		Name:          NameColumn,
		Description:   DescriptionColumn,
		StartDateTime: StartDateTimeColumn,
		EndDateTime:   EndDateTimeColumn,
		LocationID:    LocationIDColumn,
		OrganizerID:   OrganizerIDColumn,
		CreatedAt:     CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
