//
// 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 BlockedEmails = newBlockedEmailsTable("backend", "blocked_emails", "")

type blockedEmailsTable struct {
	postgres.Table

	// Columns
	Email     postgres.ColumnString
	Reason    postgres.ColumnString
	BlockedAt postgres.ColumnTimestampz

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

type BlockedEmailsTable struct {
	blockedEmailsTable

	EXCLUDED blockedEmailsTable
}

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

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

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

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

func newBlockedEmailsTable(schemaName, tableName, alias string) *BlockedEmailsTable {
	return &BlockedEmailsTable{
		blockedEmailsTable: newBlockedEmailsTableImpl(schemaName, tableName, alias),
		EXCLUDED:           newBlockedEmailsTableImpl("", "excluded", ""),
	}
}

func newBlockedEmailsTableImpl(schemaName, tableName, alias string) blockedEmailsTable {
	var (
		EmailColumn     = postgres.StringColumn("email")
		ReasonColumn    = postgres.StringColumn("reason")
		BlockedAtColumn = postgres.TimestampzColumn("blocked_at")
		allColumns      = postgres.ColumnList{EmailColumn, ReasonColumn, BlockedAtColumn}
		mutableColumns  = postgres.ColumnList{ReasonColumn, BlockedAtColumn}
		defaultColumns  = postgres.ColumnList{BlockedAtColumn}
	)

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

		//Columns
		Email:     EmailColumn,
		Reason:    ReasonColumn,
		BlockedAt: BlockedAtColumn,

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