package model

import "time"

type MapfixStatus int32

const (
	// Phase: Final MapfixStatus
	MapfixStatusRejected  MapfixStatus = 8
	MapfixStatusUploaded   MapfixStatus = 7 // uploaded to the group, final status for mapfixes

	// Phase: Testing
	MapfixStatusUploading  MapfixStatus = 6
	MapfixStatusValidated  MapfixStatus = 5
	MapfixStatusValidating MapfixStatus = 4
	MapfixStatusAccepted   MapfixStatus = 3 // pending script review, can re-trigger validation

	// Phase: Creation
	MapfixStatusChangesRequested  MapfixStatus = 2
	MapfixStatusSubmitted         MapfixStatus = 1
	MapfixStatusUnderConstruction MapfixStatus = 0
)

type Mapfix struct {
	ID            int64 `gorm:"primaryKey"`
	DisplayName   string
	Creator       string
	GameID        int32
	CreatedAt     time.Time
	UpdatedAt     time.Time
	Submitter     int64 // UserID
	AssetID       int64
	AssetVersion  int64
	ValidatedAssetID       int64
	ValidatedAssetVersion  int64
	Completed     bool   // Has this version of the map been completed at least once on maptest
	TargetAssetID int64 // where to upload map fix.  if the TargetAssetID is 0, it's a new map.
	StatusID      MapfixStatus
	StatusMessage string
}