//
// 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 Medias = newMediasTable("public", "medias", "")

type mediasTable struct {
	postgres.Table

	// Columns
	ID        postgres.ColumnInteger
	CreatedAt postgres.ColumnTimestamp
	Name      postgres.ColumnString
	MimeType  postgres.ColumnString
	Size      postgres.ColumnInteger
	Path      postgres.ColumnString
	Metas     postgres.ColumnString
	Hash      postgres.ColumnString

	AllColumns     postgres.ColumnList
	MutableColumns postgres.ColumnList
}

type MediasTable struct {
	mediasTable

	EXCLUDED mediasTable
}

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

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

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

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

func newMediasTable(schemaName, tableName, alias string) *MediasTable {
	return &MediasTable{
		mediasTable: newMediasTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newMediasTableImpl("", "excluded", ""),
	}
}

func newMediasTableImpl(schemaName, tableName, alias string) mediasTable {
	var (
		IDColumn        = postgres.IntegerColumn("id")
		CreatedAtColumn = postgres.TimestampColumn("created_at")
		NameColumn      = postgres.StringColumn("name")
		MimeTypeColumn  = postgres.StringColumn("mime_type")
		SizeColumn      = postgres.IntegerColumn("size")
		PathColumn      = postgres.StringColumn("path")
		MetasColumn     = postgres.StringColumn("metas")
		HashColumn      = postgres.StringColumn("hash")
		allColumns      = postgres.ColumnList{IDColumn, CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn, MetasColumn, HashColumn}
		mutableColumns  = postgres.ColumnList{CreatedAtColumn, NameColumn, MimeTypeColumn, SizeColumn, PathColumn, MetasColumn, HashColumn}
	)

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

		//Columns
		ID:        IDColumn,
		CreatedAt: CreatedAtColumn,
		Name:      NameColumn,
		MimeType:  MimeTypeColumn,
		Size:      SizeColumn,
		Path:      PathColumn,
		Metas:     MetasColumn,
		Hash:      HashColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
