package structs

import (
	"sync"
	"time"
)

type Robot struct {
	Id                  string
	Type                uint8
	Name                string
	Status              uint8
	PingRetries         uint8 `gorm:"-"`
	Address             string
	FirmwareVersion     string
	CurrentJobId        string
	CurrentJobName      string
	JobMutex            sync.Mutex       `gorm:"-"`
	JobsWaitingCount    int              `gorm:"-"`
	JobsWaitingNameList []JobWaitingName `gorm:"-"`
	LastTaskAt          time.Time        `gorm:"-"`
	ConnectedAt         time.Time        `gorm:"-"`
	CreatedAt           time.Time
}

type JobWaitingName struct {
	JobId string
	Name  string
}

type APIRobot struct {
	Id                  string
	Type                uint8
	Name                string
	Status              uint8
	Address             string
	CurrentJobName      string
	JobsWaitingCount    int
	JobsWaitingNameList []string
	FirmwareVersion     string
	ConnectedAt         time.Time
	CreatedAt           time.Time
}

type UnauthorizedRobot struct {
	Id              string
	Type            uint8
	Address         string
	FirmwareVersion string
	ConnectedAt     time.Time
	CreatedAt       time.Time
}

// swagger:model FirstRequestBody
type FirstRequestBody struct {
	// robot id
	Id string
	// robot type
	Type uint8
	// used firmware version of the robot
	FirmwareVersion string
	// connected modul like a gripper
	//ConnectedModul uint8
}

// swagger:model StatusResponse
type StatusResponse struct {
	Status int
}

// swagger:model RobotsResponse
type RobotsResponse struct {
	Robots     []APIRobot
	TotalPages int
}

// swagger:model UnauthorizedRobotsResponse
type UnauthorizedRobotsResponse struct {
	UnauthorizedRobots []UnauthorizedRobot
	TotalPages         int
}

type RobotIdParams struct {
	RobotId string
}

type RobotNameParams struct {
	RobotName string
}

type RobotFinishBody struct {
	RobotName string
	JobId     string
}

type UpdateRobotBody struct {
	RobotId   string
	RobotName string
}
