//
// 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 AuthChallenges = newAuthChallengesTable("backend", "auth_challenges", "")

type authChallengesTable struct {
	postgres.Table

	// Columns
	ChallengeID       postgres.ColumnString
	Email             postgres.ColumnString
	CodeHash          postgres.ColumnBytea
	Attempts          postgres.ColumnInteger
	CreatedAt         postgres.ColumnTimestampz
	ExpiresAt         postgres.ColumnTimestampz
	ConsumedAt        postgres.ColumnTimestampz
	PreferredLanguage postgres.ColumnString

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

type AuthChallengesTable struct {
	authChallengesTable

	EXCLUDED authChallengesTable
}

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

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

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

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

func newAuthChallengesTable(schemaName, tableName, alias string) *AuthChallengesTable {
	return &AuthChallengesTable{
		authChallengesTable: newAuthChallengesTableImpl(schemaName, tableName, alias),
		EXCLUDED:            newAuthChallengesTableImpl("", "excluded", ""),
	}
}

func newAuthChallengesTableImpl(schemaName, tableName, alias string) authChallengesTable {
	var (
		ChallengeIDColumn       = postgres.StringColumn("challenge_id")
		EmailColumn             = postgres.StringColumn("email")
		CodeHashColumn          = postgres.ByteaColumn("code_hash")
		AttemptsColumn          = postgres.IntegerColumn("attempts")
		CreatedAtColumn         = postgres.TimestampzColumn("created_at")
		ExpiresAtColumn         = postgres.TimestampzColumn("expires_at")
		ConsumedAtColumn        = postgres.TimestampzColumn("consumed_at")
		PreferredLanguageColumn = postgres.StringColumn("preferred_language")
		allColumns              = postgres.ColumnList{ChallengeIDColumn, EmailColumn, CodeHashColumn, AttemptsColumn, CreatedAtColumn, ExpiresAtColumn, ConsumedAtColumn, PreferredLanguageColumn}
		mutableColumns          = postgres.ColumnList{EmailColumn, CodeHashColumn, AttemptsColumn, CreatedAtColumn, ExpiresAtColumn, ConsumedAtColumn, PreferredLanguageColumn}
		defaultColumns          = postgres.ColumnList{AttemptsColumn, CreatedAtColumn, PreferredLanguageColumn}
	)

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

		//Columns
		ChallengeID:       ChallengeIDColumn,
		Email:             EmailColumn,
		CodeHash:          CodeHashColumn,
		Attempts:          AttemptsColumn,
		CreatedAt:         CreatedAtColumn,
		ExpiresAt:         ExpiresAtColumn,
		ConsumedAt:        ConsumedAtColumn,
		PreferredLanguage: PreferredLanguageColumn,

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