//
// 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 Ledger = newLedgerTable("payments", "ledger", "")

type ledgerTable struct {
	postgres.Table

	// Columns
	LedgerID          postgres.ColumnString
	AccountID         postgres.ColumnString
	Kind              postgres.ColumnString
	Source            postgres.ColumnString
	Origin            postgres.ColumnString
	ChipsDelta        postgres.ColumnInteger
	ProductID         postgres.ColumnString
	OrderID           postgres.ColumnString
	Provider          postgres.ColumnString
	ProviderPaymentID postgres.ColumnString
	Snapshot          postgres.ColumnString
	CreatedAt         postgres.ColumnTimestampz

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

type LedgerTable struct {
	ledgerTable

	EXCLUDED ledgerTable
}

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

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

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

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

func newLedgerTable(schemaName, tableName, alias string) *LedgerTable {
	return &LedgerTable{
		ledgerTable: newLedgerTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newLedgerTableImpl("", "excluded", ""),
	}
}

func newLedgerTableImpl(schemaName, tableName, alias string) ledgerTable {
	var (
		LedgerIDColumn          = postgres.StringColumn("ledger_id")
		AccountIDColumn         = postgres.StringColumn("account_id")
		KindColumn              = postgres.StringColumn("kind")
		SourceColumn            = postgres.StringColumn("source")
		OriginColumn            = postgres.StringColumn("origin")
		ChipsDeltaColumn        = postgres.IntegerColumn("chips_delta")
		ProductIDColumn         = postgres.StringColumn("product_id")
		OrderIDColumn           = postgres.StringColumn("order_id")
		ProviderColumn          = postgres.StringColumn("provider")
		ProviderPaymentIDColumn = postgres.StringColumn("provider_payment_id")
		SnapshotColumn          = postgres.StringColumn("snapshot")
		CreatedAtColumn         = postgres.TimestampzColumn("created_at")
		allColumns              = postgres.ColumnList{LedgerIDColumn, AccountIDColumn, KindColumn, SourceColumn, OriginColumn, ChipsDeltaColumn, ProductIDColumn, OrderIDColumn, ProviderColumn, ProviderPaymentIDColumn, SnapshotColumn, CreatedAtColumn}
		mutableColumns          = postgres.ColumnList{AccountIDColumn, KindColumn, SourceColumn, OriginColumn, ChipsDeltaColumn, ProductIDColumn, OrderIDColumn, ProviderColumn, ProviderPaymentIDColumn, SnapshotColumn, CreatedAtColumn}
		defaultColumns          = postgres.ColumnList{ChipsDeltaColumn, CreatedAtColumn}
	)

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

		//Columns
		LedgerID:          LedgerIDColumn,
		AccountID:         AccountIDColumn,
		Kind:              KindColumn,
		Source:            SourceColumn,
		Origin:            OriginColumn,
		ChipsDelta:        ChipsDeltaColumn,
		ProductID:         ProductIDColumn,
		OrderID:           OrderIDColumn,
		Provider:          ProviderColumn,
		ProviderPaymentID: ProviderPaymentIDColumn,
		Snapshot:          SnapshotColumn,
		CreatedAt:         CreatedAtColumn,

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