//
// 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 Identities = newIdentitiesTable("backend", "identities", "")

type identitiesTable struct {
	postgres.Table

	// Columns
	IdentityID postgres.ColumnString
	AccountID  postgres.ColumnString
	Kind       postgres.ColumnString
	ExternalID postgres.ColumnString
	Confirmed  postgres.ColumnBool
	CreatedAt  postgres.ColumnTimestampz

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

type IdentitiesTable struct {
	identitiesTable

	EXCLUDED identitiesTable
}

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

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

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

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

func newIdentitiesTable(schemaName, tableName, alias string) *IdentitiesTable {
	return &IdentitiesTable{
		identitiesTable: newIdentitiesTableImpl(schemaName, tableName, alias),
		EXCLUDED:        newIdentitiesTableImpl("", "excluded", ""),
	}
}

func newIdentitiesTableImpl(schemaName, tableName, alias string) identitiesTable {
	var (
		IdentityIDColumn = postgres.StringColumn("identity_id")
		AccountIDColumn  = postgres.StringColumn("account_id")
		KindColumn       = postgres.StringColumn("kind")
		ExternalIDColumn = postgres.StringColumn("external_id")
		ConfirmedColumn  = postgres.BoolColumn("confirmed")
		CreatedAtColumn  = postgres.TimestampzColumn("created_at")
		allColumns       = postgres.ColumnList{IdentityIDColumn, AccountIDColumn, KindColumn, ExternalIDColumn, ConfirmedColumn, CreatedAtColumn}
		mutableColumns   = postgres.ColumnList{AccountIDColumn, KindColumn, ExternalIDColumn, ConfirmedColumn, CreatedAtColumn}
		defaultColumns   = postgres.ColumnList{ConfirmedColumn, CreatedAtColumn}
	)

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

		//Columns
		IdentityID: IdentityIDColumn,
		AccountID:  AccountIDColumn,
		Kind:       KindColumn,
		ExternalID: ExternalIDColumn,
		Confirmed:  ConfirmedColumn,
		CreatedAt:  CreatedAtColumn,

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