// Code generated by gopkg.in/reform.v1. DO NOT EDIT.

package models

import (
	"fmt"
	"strings"

	"gopkg.in/reform.v1"
	"gopkg.in/reform.v1/parse"
)

type artifactTableType struct {
	s parse.StructInfo
	z []interface{}
}

// Schema returns a schema name in SQL database ("").
func (v *artifactTableType) Schema() string {
	return v.s.SQLSchema
}

// Name returns a view or table name in SQL database ("artifacts").
func (v *artifactTableType) Name() string {
	return v.s.SQLName
}

// Columns returns a new slice of column names for that view or table in SQL database.
func (v *artifactTableType) Columns() []string {
	return []string{
		"id",
		"name",
		"vendor",
		"db_version",
		"location_id",
		"service_id",
		"data_model",
		"mode",
		"status",
		"type",
		"schedule_id",
		"created_at",
		"updated_at",
	}
}

// NewStruct makes a new struct for that view or table.
func (v *artifactTableType) NewStruct() reform.Struct {
	return new(Artifact)
}

// NewRecord makes a new record for that table.
func (v *artifactTableType) NewRecord() reform.Record {
	return new(Artifact)
}

// PKColumnIndex returns an index of primary key column for that table in SQL database.
func (v *artifactTableType) PKColumnIndex() uint {
	return uint(v.s.PKFieldIndex)
}

// ArtifactTable represents artifacts view or table in SQL database.
var ArtifactTable = &artifactTableType{
	s: parse.StructInfo{
		Type:    "Artifact",
		SQLName: "artifacts",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "Name", Type: "string", Column: "name"},
			{Name: "Vendor", Type: "string", Column: "vendor"},
			{Name: "DBVersion", Type: "string", Column: "db_version"},
			{Name: "LocationID", Type: "string", Column: "location_id"},
			{Name: "ServiceID", Type: "string", Column: "service_id"},
			{Name: "DataModel", Type: "DataModel", Column: "data_model"},
			{Name: "Mode", Type: "BackupMode", Column: "mode"},
			{Name: "Status", Type: "BackupStatus", Column: "status"},
			{Name: "Type", Type: "ArtifactType", Column: "type"},
			{Name: "ScheduleID", Type: "string", Column: "schedule_id"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(Artifact).Values(),
}

// String returns a string representation of this struct or record.
func (s Artifact) String() string {
	res := make([]string, 13)
	res[0] = "ID: " + reform.Inspect(s.ID, true)
	res[1] = "Name: " + reform.Inspect(s.Name, true)
	res[2] = "Vendor: " + reform.Inspect(s.Vendor, true)
	res[3] = "DBVersion: " + reform.Inspect(s.DBVersion, true)
	res[4] = "LocationID: " + reform.Inspect(s.LocationID, true)
	res[5] = "ServiceID: " + reform.Inspect(s.ServiceID, true)
	res[6] = "DataModel: " + reform.Inspect(s.DataModel, true)
	res[7] = "Mode: " + reform.Inspect(s.Mode, true)
	res[8] = "Status: " + reform.Inspect(s.Status, true)
	res[9] = "Type: " + reform.Inspect(s.Type, true)
	res[10] = "ScheduleID: " + reform.Inspect(s.ScheduleID, true)
	res[11] = "CreatedAt: " + reform.Inspect(s.CreatedAt, true)
	res[12] = "UpdatedAt: " + reform.Inspect(s.UpdatedAt, true)
	return strings.Join(res, ", ")
}

// Values returns a slice of struct or record field values.
// Returned interface{} values are never untyped nils.
func (s *Artifact) Values() []interface{} {
	return []interface{}{
		s.ID,
		s.Name,
		s.Vendor,
		s.DBVersion,
		s.LocationID,
		s.ServiceID,
		s.DataModel,
		s.Mode,
		s.Status,
		s.Type,
		s.ScheduleID,
		s.CreatedAt,
		s.UpdatedAt,
	}
}

// Pointers returns a slice of pointers to struct or record fields.
// Returned interface{} values are never untyped nils.
func (s *Artifact) Pointers() []interface{} {
	return []interface{}{
		&s.ID,
		&s.Name,
		&s.Vendor,
		&s.DBVersion,
		&s.LocationID,
		&s.ServiceID,
		&s.DataModel,
		&s.Mode,
		&s.Status,
		&s.Type,
		&s.ScheduleID,
		&s.CreatedAt,
		&s.UpdatedAt,
	}
}

// View returns View object for that struct.
func (s *Artifact) View() reform.View {
	return ArtifactTable
}

// Table returns Table object for that record.
func (s *Artifact) Table() reform.Table {
	return ArtifactTable
}

// PKValue returns a value of primary key for that record.
// Returned interface{} value is never untyped nil.
func (s *Artifact) PKValue() interface{} {
	return s.ID
}

// PKPointer returns a pointer to primary key field for that record.
// Returned interface{} value is never untyped nil.
func (s *Artifact) PKPointer() interface{} {
	return &s.ID
}

// HasPK returns true if record has non-zero primary key set, false otherwise.
func (s *Artifact) HasPK() bool {
	return s.ID != ArtifactTable.z[ArtifactTable.s.PKFieldIndex]
}

// SetPK sets record primary key, if possible.
//
// Deprecated: prefer direct field assignment where possible: s.ID = pk.
func (s *Artifact) SetPK(pk interface{}) {
	reform.SetPK(s, pk)
}

// check interfaces
var (
	_ reform.View   = ArtifactTable
	_ reform.Struct = (*Artifact)(nil)
	_ reform.Table  = ArtifactTable
	_ reform.Record = (*Artifact)(nil)
	_ fmt.Stringer  = (*Artifact)(nil)
)

func init() {
	parse.AssertUpToDate(&ArtifactTable.s, new(Artifact))
}
