//
// 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/Gleipnir-Technology/jet/postgres"
)

var LogImpersonation = newLogImpersonationTable("public", "log_impersonation", "")

type logImpersonationTable struct {
	postgres.Table

	// Columns
	BeginAt        postgres.ColumnTimestamp
	EndAt          postgres.ColumnTimestamp
	ID             postgres.ColumnInteger
	ImpersonatorID postgres.ColumnInteger
	TargetID       postgres.ColumnInteger

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

type LogImpersonationTable struct {
	logImpersonationTable

	EXCLUDED logImpersonationTable
}

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

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

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

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

func newLogImpersonationTable(schemaName, tableName, alias string) *LogImpersonationTable {
	return &LogImpersonationTable{
		logImpersonationTable: newLogImpersonationTableImpl(schemaName, tableName, alias),
		EXCLUDED:              newLogImpersonationTableImpl("", "excluded", ""),
	}
}

func newLogImpersonationTableImpl(schemaName, tableName, alias string) logImpersonationTable {
	var (
		BeginAtColumn        = postgres.TimestampColumn("begin_at")
		EndAtColumn          = postgres.TimestampColumn("end_at")
		IDColumn             = postgres.IntegerColumn("id")
		ImpersonatorIDColumn = postgres.IntegerColumn("impersonator_id")
		TargetIDColumn       = postgres.IntegerColumn("target_id")
		allColumns           = postgres.ColumnList{BeginAtColumn, EndAtColumn, IDColumn, ImpersonatorIDColumn, TargetIDColumn}
		mutableColumns       = postgres.ColumnList{BeginAtColumn, EndAtColumn, ImpersonatorIDColumn, TargetIDColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		BeginAt:        BeginAtColumn,
		EndAt:          EndAtColumn,
		ID:             IDColumn,
		ImpersonatorID: ImpersonatorIDColumn,
		TargetID:       TargetIDColumn,

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