//
// 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 Product = newProductTable("payments", "product", "")

type productTable struct {
	postgres.Table

	// Columns
	ProductID postgres.ColumnString
	Title     postgres.ColumnString
	Active    postgres.ColumnBool
	CreatedAt postgres.ColumnTimestampz
	UpdatedAt postgres.ColumnTimestampz

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

type ProductTable struct {
	productTable

	EXCLUDED productTable
}

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

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

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

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

func newProductTable(schemaName, tableName, alias string) *ProductTable {
	return &ProductTable{
		productTable: newProductTableImpl(schemaName, tableName, alias),
		EXCLUDED:     newProductTableImpl("", "excluded", ""),
	}
}

func newProductTableImpl(schemaName, tableName, alias string) productTable {
	var (
		ProductIDColumn = postgres.StringColumn("product_id")
		TitleColumn     = postgres.StringColumn("title")
		ActiveColumn    = postgres.BoolColumn("active")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		UpdatedAtColumn = postgres.TimestampzColumn("updated_at")
		allColumns      = postgres.ColumnList{ProductIDColumn, TitleColumn, ActiveColumn, CreatedAtColumn, UpdatedAtColumn}
		mutableColumns  = postgres.ColumnList{TitleColumn, ActiveColumn, CreatedAtColumn, UpdatedAtColumn}
		defaultColumns  = postgres.ColumnList{TitleColumn, ActiveColumn, CreatedAtColumn, UpdatedAtColumn}
	)

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

		//Columns
		ProductID: ProductIDColumn,
		Title:     TitleColumn,
		Active:    ActiveColumn,
		CreatedAt: CreatedAtColumn,
		UpdatedAt: UpdatedAtColumn,

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