//
// 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 Applications = newApplicationsTable("backend", "applications", "")

type applicationsTable struct {
	postgres.Table

	// Columns
	ApplicationID   postgres.ColumnString
	GameID          postgres.ColumnString
	ApplicantUserID postgres.ColumnString
	RaceName        postgres.ColumnString
	Status          postgres.ColumnString
	CreatedAt       postgres.ColumnTimestampz
	DecidedAt       postgres.ColumnTimestampz

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

type ApplicationsTable struct {
	applicationsTable

	EXCLUDED applicationsTable
}

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

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

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

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

func newApplicationsTable(schemaName, tableName, alias string) *ApplicationsTable {
	return &ApplicationsTable{
		applicationsTable: newApplicationsTableImpl(schemaName, tableName, alias),
		EXCLUDED:          newApplicationsTableImpl("", "excluded", ""),
	}
}

func newApplicationsTableImpl(schemaName, tableName, alias string) applicationsTable {
	var (
		ApplicationIDColumn   = postgres.StringColumn("application_id")
		GameIDColumn          = postgres.StringColumn("game_id")
		ApplicantUserIDColumn = postgres.StringColumn("applicant_user_id")
		RaceNameColumn        = postgres.StringColumn("race_name")
		StatusColumn          = postgres.StringColumn("status")
		CreatedAtColumn       = postgres.TimestampzColumn("created_at")
		DecidedAtColumn       = postgres.TimestampzColumn("decided_at")
		allColumns            = postgres.ColumnList{ApplicationIDColumn, GameIDColumn, ApplicantUserIDColumn, RaceNameColumn, StatusColumn, CreatedAtColumn, DecidedAtColumn}
		mutableColumns        = postgres.ColumnList{GameIDColumn, ApplicantUserIDColumn, RaceNameColumn, StatusColumn, CreatedAtColumn, DecidedAtColumn}
		defaultColumns        = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		ApplicationID:   ApplicationIDColumn,
		GameID:          GameIDColumn,
		ApplicantUserID: ApplicantUserIDColumn,
		RaceName:        RaceNameColumn,
		Status:          StatusColumn,
		CreatedAt:       CreatedAtColumn,
		DecidedAt:       DecidedAtColumn,

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