//
// 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 Orders = newOrdersTable("public", "orders", "")

type ordersTable struct {
	postgres.Table

	// Columns
	ID                  postgres.ColumnInteger
	CreatedAt           postgres.ColumnTimestamp
	UpdatedAt           postgres.ColumnTimestamp
	OrderNo             postgres.ColumnString
	SubOrderNo          postgres.ColumnString
	TransactionID       postgres.ColumnString
	RefundTransactionID postgres.ColumnString
	Price               postgres.ColumnInteger
	Discount            postgres.ColumnInteger
	Currency            postgres.ColumnString
	PaymentMethod       postgres.ColumnString
	PostID              postgres.ColumnInteger
	UserID              postgres.ColumnInteger
	Status              postgres.ColumnInteger
	Meta                postgres.ColumnString

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type OrdersTable struct {
	ordersTable

	EXCLUDED ordersTable
}

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

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

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

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

func newOrdersTable(schemaName, tableName, alias string) *OrdersTable {
	return &OrdersTable{
		ordersTable: newOrdersTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newOrdersTableImpl("", "excluded", ""),
	}
}

func newOrdersTableImpl(schemaName, tableName, alias string) ordersTable {
	var (
		IDColumn                  = postgres.IntegerColumn("id")
		CreatedAtColumn           = postgres.TimestampColumn("created_at")
		UpdatedAtColumn           = postgres.TimestampColumn("updated_at")
		OrderNoColumn             = postgres.StringColumn("order_no")
		SubOrderNoColumn          = postgres.StringColumn("sub_order_no")
		TransactionIDColumn       = postgres.StringColumn("transaction_id")
		RefundTransactionIDColumn = postgres.StringColumn("refund_transaction_id")
		PriceColumn               = postgres.IntegerColumn("price")
		DiscountColumn            = postgres.IntegerColumn("discount")
		CurrencyColumn            = postgres.StringColumn("currency")
		PaymentMethodColumn       = postgres.StringColumn("payment_method")
		PostIDColumn              = postgres.IntegerColumn("post_id")
		UserIDColumn              = postgres.IntegerColumn("user_id")
		StatusColumn              = postgres.IntegerColumn("status")
		MetaColumn                = postgres.StringColumn("meta")
		allColumns                = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, OrderNoColumn, SubOrderNoColumn, TransactionIDColumn, RefundTransactionIDColumn, PriceColumn, DiscountColumn, CurrencyColumn, PaymentMethodColumn, PostIDColumn, UserIDColumn, StatusColumn, MetaColumn}
		mutableColumns            = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, OrderNoColumn, SubOrderNoColumn, TransactionIDColumn, RefundTransactionIDColumn, PriceColumn, DiscountColumn, CurrencyColumn, PaymentMethodColumn, PostIDColumn, UserIDColumn, StatusColumn, MetaColumn}
	)

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

		//Columns
		ID:                  IDColumn,
		CreatedAt:           CreatedAtColumn,
		UpdatedAt:           UpdatedAtColumn,
		OrderNo:             OrderNoColumn,
		SubOrderNo:          SubOrderNoColumn,
		TransactionID:       TransactionIDColumn,
		RefundTransactionID: RefundTransactionIDColumn,
		Price:               PriceColumn,
		Discount:            DiscountColumn,
		Currency:            CurrencyColumn,
		PaymentMethod:       PaymentMethodColumn,
		PostID:              PostIDColumn,
		UserID:              UserIDColumn,
		Status:              StatusColumn,
		Meta:                MetaColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
