//
// 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 Memberships = newMembershipsTable("backend", "memberships", "")

type membershipsTable struct {
	postgres.Table

	// Columns
	MembershipID postgres.ColumnString
	GameID       postgres.ColumnString
	UserID       postgres.ColumnString
	RaceName     postgres.ColumnString
	CanonicalKey postgres.ColumnString
	Status       postgres.ColumnString
	JoinedAt     postgres.ColumnTimestampz
	RemovedAt    postgres.ColumnTimestampz

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

type MembershipsTable struct {
	membershipsTable

	EXCLUDED membershipsTable
}

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

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

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

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

func newMembershipsTable(schemaName, tableName, alias string) *MembershipsTable {
	return &MembershipsTable{
		membershipsTable: newMembershipsTableImpl(schemaName, tableName, alias),
		EXCLUDED:         newMembershipsTableImpl("", "excluded", ""),
	}
}

func newMembershipsTableImpl(schemaName, tableName, alias string) membershipsTable {
	var (
		MembershipIDColumn = postgres.StringColumn("membership_id")
		GameIDColumn       = postgres.StringColumn("game_id")
		UserIDColumn       = postgres.StringColumn("user_id")
		RaceNameColumn     = postgres.StringColumn("race_name")
		CanonicalKeyColumn = postgres.StringColumn("canonical_key")
		StatusColumn       = postgres.StringColumn("status")
		JoinedAtColumn     = postgres.TimestampzColumn("joined_at")
		RemovedAtColumn    = postgres.TimestampzColumn("removed_at")
		allColumns         = postgres.ColumnList{MembershipIDColumn, GameIDColumn, UserIDColumn, RaceNameColumn, CanonicalKeyColumn, StatusColumn, JoinedAtColumn, RemovedAtColumn}
		mutableColumns     = postgres.ColumnList{GameIDColumn, UserIDColumn, RaceNameColumn, CanonicalKeyColumn, StatusColumn, JoinedAtColumn, RemovedAtColumn}
		defaultColumns     = postgres.ColumnList{JoinedAtColumn}
	)

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

		//Columns
		MembershipID: MembershipIDColumn,
		GameID:       GameIDColumn,
		UserID:       UserIDColumn,
		RaceName:     RaceNameColumn,
		CanonicalKey: CanonicalKeyColumn,
		Status:       StatusColumn,
		JoinedAt:     JoinedAtColumn,
		RemovedAt:    RemovedAtColumn,

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