//
// 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 Tasks = newTasksTable("public", "tasks", "")

type tasksTable struct {
	postgres.Table

	// Columns
	ID                 postgres.ColumnInteger
	CreatedAt          postgres.ColumnTimestampz
	CreatedByID        postgres.ColumnInteger
	RelevantVersionID  postgres.ColumnInteger
	PublishedVersionID postgres.ColumnInteger

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type TasksTable struct {
	tasksTable

	EXCLUDED tasksTable
}

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

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

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

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

func newTasksTable(schemaName, tableName, alias string) *TasksTable {
	return &TasksTable{
		tasksTable: newTasksTableImpl(schemaName, tableName, alias),
		EXCLUDED:   newTasksTableImpl("", "excluded", ""),
	}
}

func newTasksTableImpl(schemaName, tableName, alias string) tasksTable {
	var (
		IDColumn                 = postgres.IntegerColumn("id")
		CreatedAtColumn          = postgres.TimestampzColumn("created_at")
		CreatedByIDColumn        = postgres.IntegerColumn("created_by_id")
		RelevantVersionIDColumn  = postgres.IntegerColumn("relevant_version_id")
		PublishedVersionIDColumn = postgres.IntegerColumn("published_version_id")
		allColumns               = postgres.ColumnList{IDColumn, CreatedAtColumn, CreatedByIDColumn, RelevantVersionIDColumn, PublishedVersionIDColumn}
		mutableColumns           = postgres.ColumnList{CreatedAtColumn, CreatedByIDColumn, RelevantVersionIDColumn, PublishedVersionIDColumn}
	)

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

		//Columns
		ID:                 IDColumn,
		CreatedAt:          CreatedAtColumn,
		CreatedByID:        CreatedByIDColumn,
		RelevantVersionID:  RelevantVersionIDColumn,
		PublishedVersionID: PublishedVersionIDColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
