//
// 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 ErrorCsv = newErrorCsvTable("fileupload", "error_csv", "")

type errorCsvTable struct {
	postgres.Table

	// Columns
	Col       postgres.ColumnInteger
	CsvFileID postgres.ColumnInteger
	ID        postgres.ColumnInteger
	Line      postgres.ColumnInteger
	Message   postgres.ColumnString

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

type ErrorCsvTable struct {
	errorCsvTable

	EXCLUDED errorCsvTable
}

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

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

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

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

func newErrorCsvTable(schemaName, tableName, alias string) *ErrorCsvTable {
	return &ErrorCsvTable{
		errorCsvTable: newErrorCsvTableImpl(schemaName, tableName, alias),
		EXCLUDED:      newErrorCsvTableImpl("", "excluded", ""),
	}
}

func newErrorCsvTableImpl(schemaName, tableName, alias string) errorCsvTable {
	var (
		ColColumn       = postgres.IntegerColumn("col")
		CsvFileIDColumn = postgres.IntegerColumn("csv_file_id")
		IDColumn        = postgres.IntegerColumn("id")
		LineColumn      = postgres.IntegerColumn("line")
		MessageColumn   = postgres.StringColumn("message")
		allColumns      = postgres.ColumnList{ColColumn, CsvFileIDColumn, IDColumn, LineColumn, MessageColumn}
		mutableColumns  = postgres.ColumnList{ColColumn, CsvFileIDColumn, LineColumn, MessageColumn}
		defaultColumns  = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		Col:       ColColumn,
		CsvFileID: CsvFileIDColumn,
		ID:        IDColumn,
		Line:      LineColumn,
		Message:   MessageColumn,

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