//
// 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 APIRequest = newAPIRequestTable("stadia", "api_request", "")

type aPIRequestTable struct {
	postgres.Table

	// Columns
	ID        postgres.ColumnInteger
	Request   postgres.ColumnString
	Response  postgres.ColumnString
	CreatedAt postgres.ColumnTimestamp

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

type APIRequestTable struct {
	aPIRequestTable

	EXCLUDED aPIRequestTable
}

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

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

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

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

func newAPIRequestTable(schemaName, tableName, alias string) *APIRequestTable {
	return &APIRequestTable{
		aPIRequestTable: newAPIRequestTableImpl(schemaName, tableName, alias),
		EXCLUDED:        newAPIRequestTableImpl("", "excluded", ""),
	}
}

func newAPIRequestTableImpl(schemaName, tableName, alias string) aPIRequestTable {
	var (
		IDColumn        = postgres.IntegerColumn("id")
		RequestColumn   = postgres.StringColumn("request")
		ResponseColumn  = postgres.StringColumn("response")
		CreatedAtColumn = postgres.TimestampColumn("created_at")
		allColumns      = postgres.ColumnList{IDColumn, RequestColumn, ResponseColumn, CreatedAtColumn}
		mutableColumns  = postgres.ColumnList{RequestColumn, ResponseColumn, CreatedAtColumn}
		defaultColumns  = postgres.ColumnList{IDColumn}
	)

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

		//Columns
		ID:        IDColumn,
		Request:   RequestColumn,
		Response:  ResponseColumn,
		CreatedAt: CreatedAtColumn,

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