//
// 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/Gleipnir-Technology/jet/postgres"
)

var ErrorFile = newErrorFileTable("fileupload", "error_file", "")

type errorFileTable struct {
	postgres.Table

	// Columns
	FileID  postgres.ColumnInteger
	ID      postgres.ColumnInteger
	Message postgres.ColumnString

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

type ErrorFileTable struct {
	errorFileTable

	EXCLUDED errorFileTable
}

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

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

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

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

func newErrorFileTable(schemaName, tableName, alias string) *ErrorFileTable {
	return &ErrorFileTable{
		errorFileTable: newErrorFileTableImpl(schemaName, tableName, alias),
		EXCLUDED:       newErrorFileTableImpl("", "excluded", ""),
	}
}

func newErrorFileTableImpl(schemaName, tableName, alias string) errorFileTable {
	var (
		FileIDColumn   = postgres.IntegerColumn("file_id")
		IDColumn       = postgres.IntegerColumn("id")
		MessageColumn  = postgres.StringColumn("message")
		allColumns     = postgres.ColumnList{FileIDColumn, IDColumn, MessageColumn}
		mutableColumns = postgres.ColumnList{FileIDColumn, MessageColumn}
		defaultColumns = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		FileID:  FileIDColumn,
		ID:      IDColumn,
		Message: MessageColumn,

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