//
// 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 UserPosts = newUserPostsTable("public", "user_posts", "")

type userPostsTable struct {
	postgres.Table

	// Columns
	ID        postgres.ColumnInteger
	CreatedAt postgres.ColumnTimestamp
	UpdatedAt postgres.ColumnTimestamp
	UserID    postgres.ColumnInteger
	PostID    postgres.ColumnInteger
	Price     postgres.ColumnInteger

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type UserPostsTable struct {
	userPostsTable

	EXCLUDED userPostsTable
}

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

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

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

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

func newUserPostsTable(schemaName, tableName, alias string) *UserPostsTable {
	return &UserPostsTable{
		userPostsTable: newUserPostsTableImpl(schemaName, tableName, alias),
		EXCLUDED:       newUserPostsTableImpl("", "excluded", ""),
	}
}

func newUserPostsTableImpl(schemaName, tableName, alias string) userPostsTable {
	var (
		IDColumn        = postgres.IntegerColumn("id")
		CreatedAtColumn = postgres.TimestampColumn("created_at")
		UpdatedAtColumn = postgres.TimestampColumn("updated_at")
		UserIDColumn    = postgres.IntegerColumn("user_id")
		PostIDColumn    = postgres.IntegerColumn("post_id")
		PriceColumn     = postgres.IntegerColumn("price")
		allColumns      = postgres.ColumnList{IDColumn, CreatedAtColumn, UpdatedAtColumn, UserIDColumn, PostIDColumn, PriceColumn}
		mutableColumns  = postgres.ColumnList{CreatedAtColumn, UpdatedAtColumn, UserIDColumn, PostIDColumn, PriceColumn}
	)

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

		//Columns
		ID:        IDColumn,
		CreatedAt: CreatedAtColumn,
		UpdatedAt: UpdatedAtColumn,
		UserID:    UserIDColumn,
		PostID:    PostIDColumn,
		Price:     PriceColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
