//
// 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 DictionaryState = newDictionaryStateTable("backend", "dictionary_state", "")

type dictionaryStateTable struct {
	postgres.Table

	// Columns
	ID            postgres.ColumnBool
	ActiveVersion postgres.ColumnString
	UpdatedAt     postgres.ColumnTimestampz

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

type DictionaryStateTable struct {
	dictionaryStateTable

	EXCLUDED dictionaryStateTable
}

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

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

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

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

func newDictionaryStateTable(schemaName, tableName, alias string) *DictionaryStateTable {
	return &DictionaryStateTable{
		dictionaryStateTable: newDictionaryStateTableImpl(schemaName, tableName, alias),
		EXCLUDED:             newDictionaryStateTableImpl("", "excluded", ""),
	}
}

func newDictionaryStateTableImpl(schemaName, tableName, alias string) dictionaryStateTable {
	var (
		IDColumn            = postgres.BoolColumn("id")
		ActiveVersionColumn = postgres.StringColumn("active_version")
		UpdatedAtColumn     = postgres.TimestampzColumn("updated_at")
		allColumns          = postgres.ColumnList{IDColumn, ActiveVersionColumn, UpdatedAtColumn}
		mutableColumns      = postgres.ColumnList{ActiveVersionColumn, UpdatedAtColumn}
		defaultColumns      = postgres.ColumnList{IDColumn, UpdatedAtColumn}
	)

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

		//Columns
		ID:            IDColumn,
		ActiveVersion: ActiveVersionColumn,
		UpdatedAt:     UpdatedAtColumn,

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