//
// 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 Resident = newResidentTable("public", "resident", "")

type residentTable struct {
	postgres.Table

	// Columns
	AddressID   postgres.ColumnInteger
	Created     postgres.ColumnTimestamp
	Creator     postgres.ColumnInteger
	ID          postgres.ColumnInteger
	Name        postgres.ColumnString
	PhoneMobile postgres.ColumnString
	SiteID      postgres.ColumnInteger

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

type ResidentTable struct {
	residentTable

	EXCLUDED residentTable
}

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

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

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

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

func newResidentTable(schemaName, tableName, alias string) *ResidentTable {
	return &ResidentTable{
		residentTable: newResidentTableImpl(schemaName, tableName, alias),
		EXCLUDED:      newResidentTableImpl("", "excluded", ""),
	}
}

func newResidentTableImpl(schemaName, tableName, alias string) residentTable {
	var (
		AddressIDColumn   = postgres.IntegerColumn("address_id")
		CreatedColumn     = postgres.TimestampColumn("created")
		CreatorColumn     = postgres.IntegerColumn("creator")
		IDColumn          = postgres.IntegerColumn("id")
		NameColumn        = postgres.StringColumn("name")
		PhoneMobileColumn = postgres.StringColumn("phone_mobile")
		SiteIDColumn      = postgres.IntegerColumn("site_id")
		allColumns        = postgres.ColumnList{AddressIDColumn, CreatedColumn, CreatorColumn, IDColumn, NameColumn, PhoneMobileColumn, SiteIDColumn}
		mutableColumns    = postgres.ColumnList{AddressIDColumn, CreatedColumn, CreatorColumn, NameColumn, PhoneMobileColumn, SiteIDColumn}
		defaultColumns    = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		AddressID:   AddressIDColumn,
		Created:     CreatedColumn,
		Creator:     CreatorColumn,
		ID:          IDColumn,
		Name:        NameColumn,
		PhoneMobile: PhoneMobileColumn,
		SiteID:      SiteIDColumn,

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