//
// 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 UserCountryCounters = newUserCountryCountersTable("backend", "user_country_counters", "")

type userCountryCountersTable struct {
	postgres.Table

	// Columns
	UserID     postgres.ColumnString
	Country    postgres.ColumnString
	Count      postgres.ColumnInteger
	LastSeenAt postgres.ColumnTimestampz

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

type UserCountryCountersTable struct {
	userCountryCountersTable

	EXCLUDED userCountryCountersTable
}

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

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

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

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

func newUserCountryCountersTable(schemaName, tableName, alias string) *UserCountryCountersTable {
	return &UserCountryCountersTable{
		userCountryCountersTable: newUserCountryCountersTableImpl(schemaName, tableName, alias),
		EXCLUDED:                 newUserCountryCountersTableImpl("", "excluded", ""),
	}
}

func newUserCountryCountersTableImpl(schemaName, tableName, alias string) userCountryCountersTable {
	var (
		UserIDColumn     = postgres.StringColumn("user_id")
		CountryColumn    = postgres.StringColumn("country")
		CountColumn      = postgres.IntegerColumn("count")
		LastSeenAtColumn = postgres.TimestampzColumn("last_seen_at")
		allColumns       = postgres.ColumnList{UserIDColumn, CountryColumn, CountColumn, LastSeenAtColumn}
		mutableColumns   = postgres.ColumnList{CountColumn, LastSeenAtColumn}
		defaultColumns   = postgres.ColumnList{CountColumn}
	)

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

		//Columns
		UserID:     UserIDColumn,
		Country:    CountryColumn,
		Count:      CountColumn,
		LastSeenAt: LastSeenAtColumn,

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