//
// 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 Logs = newLogsTable("haystack", "logs", "")

type logsTable struct {
	postgres.Table

	// Columns
	Log       postgres.ColumnString
	ImageID   postgres.ColumnString
	CreatedAt postgres.ColumnTimestampz

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type LogsTable struct {
	logsTable

	EXCLUDED logsTable
}

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

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

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

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

func newLogsTable(schemaName, tableName, alias string) *LogsTable {
	return &LogsTable{
		logsTable: newLogsTableImpl(schemaName, tableName, alias),
		EXCLUDED:  newLogsTableImpl("", "excluded", ""),
	}
}

func newLogsTableImpl(schemaName, tableName, alias string) logsTable {
	var (
		LogColumn       = postgres.StringColumn("log")
		ImageIDColumn   = postgres.StringColumn("image_id")
		CreatedAtColumn = postgres.TimestampzColumn("created_at")
		allColumns      = postgres.ColumnList{LogColumn, ImageIDColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{LogColumn, ImageIDColumn, CreatedAtColumn}
	)

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

		//Columns
		Log:       LogColumn,
		ImageID:   ImageIDColumn,
		CreatedAt: CreatedAtColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
