//
// 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 DeviceSessions = newDeviceSessionsTable("backend", "device_sessions", "")

type deviceSessionsTable struct {
	postgres.Table

	// Columns
	DeviceSessionID postgres.ColumnString
	UserID          postgres.ColumnString
	ClientPublicKey postgres.ColumnBytea
	Status          postgres.ColumnString
	CreatedAt       postgres.ColumnTimestampz
	LastSeenAt      postgres.ColumnTimestampz
	RevokedAt       postgres.ColumnTimestampz

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

type DeviceSessionsTable struct {
	deviceSessionsTable

	EXCLUDED deviceSessionsTable
}

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

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

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

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

func newDeviceSessionsTable(schemaName, tableName, alias string) *DeviceSessionsTable {
	return &DeviceSessionsTable{
		deviceSessionsTable: newDeviceSessionsTableImpl(schemaName, tableName, alias),
		EXCLUDED:            newDeviceSessionsTableImpl("", "excluded", ""),
	}
}

func newDeviceSessionsTableImpl(schemaName, tableName, alias string) deviceSessionsTable {
	var (
		DeviceSessionIDColumn = postgres.StringColumn("device_session_id")
		UserIDColumn          = postgres.StringColumn("user_id")
		ClientPublicKeyColumn = postgres.ByteaColumn("client_public_key")
		StatusColumn          = postgres.StringColumn("status")
		CreatedAtColumn       = postgres.TimestampzColumn("created_at")
		LastSeenAtColumn      = postgres.TimestampzColumn("last_seen_at")
		RevokedAtColumn       = postgres.TimestampzColumn("revoked_at")
		allColumns            = postgres.ColumnList{DeviceSessionIDColumn, UserIDColumn, ClientPublicKeyColumn, StatusColumn, CreatedAtColumn, LastSeenAtColumn, RevokedAtColumn}
		mutableColumns        = postgres.ColumnList{UserIDColumn, ClientPublicKeyColumn, StatusColumn, CreatedAtColumn, LastSeenAtColumn, RevokedAtColumn}
		defaultColumns        = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		DeviceSessionID: DeviceSessionIDColumn,
		UserID:          UserIDColumn,
		ClientPublicKey: ClientPublicKeyColumn,
		Status:          StatusColumn,
		CreatedAt:       CreatedAtColumn,
		LastSeenAt:      LastSeenAtColumn,
		RevokedAt:       RevokedAtColumn,

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