//
// 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 UserNotes = newUserNotesTable("haystack", "user_notes", "")

type userNotesTable struct {
	postgres.Table

	// Columns
	ID        postgres.ColumnString
	UserID    postgres.ColumnString
	NoteID    postgres.ColumnString
	CreatedAt postgres.ColumnTimestampz

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserNotesTable struct {
	userNotesTable

	EXCLUDED userNotesTable
}

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

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

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

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

func newUserNotesTable(schemaName, tableName, alias string) *UserNotesTable {
	return &UserNotesTable{
		userNotesTable: newUserNotesTableImpl(schemaName, tableName, alias),
		EXCLUDED:       newUserNotesTableImpl("", "excluded", ""),
	}
}

func newUserNotesTableImpl(schemaName, tableName, alias string) userNotesTable {
	var (
		IDColumn        = postgres.StringColumn("id")
		UserIDColumn    = postgres.StringColumn("user_id")
		NoteIDColumn    = postgres.StringColumn("note_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{IDColumn, UserIDColumn, NoteIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{UserIDColumn, NoteIDColumn, CreatedAtColumn}
	)

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

		//Columns
		ID:        IDColumn,
		UserID:    UserIDColumn,
		NoteID:    NoteIDColumn,
		CreatedAt: CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
