//
// 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 Blocks = newBlocksTable("backend", "blocks", "")

type blocksTable struct {
	postgres.Table

	// Columns
	BlockerID postgres.ColumnString
	BlockedID postgres.ColumnString
	CreatedAt postgres.ColumnTimestampz

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

type BlocksTable struct {
	blocksTable

	EXCLUDED blocksTable
}

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

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

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

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

func newBlocksTable(schemaName, tableName, alias string) *BlocksTable {
	return &BlocksTable{
		blocksTable: newBlocksTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newBlocksTableImpl("", "excluded", ""),
	}
}

func newBlocksTableImpl(schemaName, tableName, alias string) blocksTable {
	var (
		BlockerIDColumn = postgres.StringColumn("blocker_id")
		BlockedIDColumn = postgres.StringColumn("blocked_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{BlockerIDColumn, BlockedIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{CreatedAtColumn}
		defaultColumns  = postgres.ColumnList{CreatedAtColumn}
	)

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

		//Columns
		BlockerID: BlockerIDColumn,
		BlockedID: BlockedIDColumn,
		CreatedAt: CreatedAtColumn,

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