//
// 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/sqlite"
)

var Device = newDeviceTable("", "device", "")

type deviceTable struct {
	sqlite.Table

	// Columns
	ID     sqlite.ColumnInteger
	UUID   sqlite.ColumnString
	Name   sqlite.ColumnString
	Expert sqlite.ColumnString
	State  sqlite.ColumnString
	Note   sqlite.ColumnString

	AllColumns     sqlite.ColumnList
	MutableColumns sqlite.ColumnList
}

type DeviceTable struct {
	deviceTable

	EXCLUDED deviceTable
}

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

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

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

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

func newDeviceTable(schemaName, tableName, alias string) *DeviceTable {
	return &DeviceTable{
		deviceTable: newDeviceTableImpl(schemaName, tableName, alias),
		EXCLUDED:    newDeviceTableImpl("", "excluded", ""),
	}
}

func newDeviceTableImpl(schemaName, tableName, alias string) deviceTable {
	var (
		IDColumn       = sqlite.IntegerColumn("id")
		UUIDColumn     = sqlite.StringColumn("uuid")
		NameColumn     = sqlite.StringColumn("name")
		ExpertColumn   = sqlite.StringColumn("expert")
		StateColumn    = sqlite.StringColumn("state")
		NoteColumn     = sqlite.StringColumn("note")
		allColumns     = sqlite.ColumnList{IDColumn, UUIDColumn, NameColumn, ExpertColumn, StateColumn, NoteColumn}
		mutableColumns = sqlite.ColumnList{UUIDColumn, NameColumn, ExpertColumn, StateColumn, NoteColumn}
	)

	return deviceTable{
		Table: sqlite.NewTable(schemaName, tableName, alias, allColumns...),

		//Columns
		ID:     IDColumn,
		UUID:   UUIDColumn,
		Name:   NameColumn,
		Expert: ExpertColumn,
		State:  StateColumn,
		Note:   NoteColumn,

		AllColumns:     allColumns,
		MutableColumns: mutableColumns,
	}
}
