//
// 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 File = newFileTable("fileupload", "file", "")

type fileTable struct {
	postgres.Table

	// Columns
	ID             postgres.ColumnInteger
	ContentType    postgres.ColumnString
	Created        postgres.ColumnTimestamp
	CreatorID      postgres.ColumnInteger
	Deleted        postgres.ColumnTimestamp
	Name           postgres.ColumnString
	OrganizationID postgres.ColumnInteger
	Status         postgres.ColumnString
	SizeBytes      postgres.ColumnInteger
	FileUUID       postgres.ColumnString
	Committer      postgres.ColumnInteger
	Error          postgres.ColumnString

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

type FileTable struct {
	fileTable

	EXCLUDED fileTable
}

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

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

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

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

func newFileTable(schemaName, tableName, alias string) *FileTable {
	return &FileTable{
		fileTable: newFileTableImpl(schemaName, tableName, alias),
		EXCLUDED:  newFileTableImpl("", "excluded", ""),
	}
}

func newFileTableImpl(schemaName, tableName, alias string) fileTable {
	var (
		IDColumn             = postgres.IntegerColumn("id")
		ContentTypeColumn    = postgres.StringColumn("content_type")
		CreatedColumn        = postgres.TimestampColumn("created")
		CreatorIDColumn      = postgres.IntegerColumn("creator_id")
		DeletedColumn        = postgres.TimestampColumn("deleted")
		NameColumn           = postgres.StringColumn("name")
		OrganizationIDColumn = postgres.IntegerColumn("organization_id")
		StatusColumn         = postgres.StringColumn("status")
		SizeBytesColumn      = postgres.IntegerColumn("size_bytes")
		FileUUIDColumn       = postgres.StringColumn("file_uuid")
		CommitterColumn      = postgres.IntegerColumn("committer")
		ErrorColumn          = postgres.StringColumn("error")
		allColumns           = postgres.ColumnList{IDColumn, ContentTypeColumn, CreatedColumn, CreatorIDColumn, DeletedColumn, NameColumn, OrganizationIDColumn, StatusColumn, SizeBytesColumn, FileUUIDColumn, CommitterColumn, ErrorColumn}
		mutableColumns       = postgres.ColumnList{ContentTypeColumn, CreatedColumn, CreatorIDColumn, DeletedColumn, NameColumn, OrganizationIDColumn, StatusColumn, SizeBytesColumn, FileUUIDColumn, CommitterColumn, ErrorColumn}
		defaultColumns       = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		ID:             IDColumn,
		ContentType:    ContentTypeColumn,
		Created:        CreatedColumn,
		CreatorID:      CreatorIDColumn,
		Deleted:        DeletedColumn,
		Name:           NameColumn,
		OrganizationID: OrganizationIDColumn,
		Status:         StatusColumn,
		SizeBytes:      SizeBytesColumn,
		FileUUID:       FileUUIDColumn,
		Committer:      CommitterColumn,
		Error:          ErrorColumn,

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