models

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckPointInAnyGeofenceRequest

type CheckPointInAnyGeofenceRequest struct {
	SpaceID   uuid.UUID `json:"space_id" validate:"required,uuid"`
	Latitude  float64   `json:"latitude" validate:"required,min=-90,max=90"`
	Longitude float64   `json:"longitude" validate:"required,min=-180,max=180"`
}

CheckPointInAnyGeofenceRequest represents a request to check if a point is within any geofence in a space

type CheckPointInGeofenceRequest

type CheckPointInGeofenceRequest struct {
	GeofenceID uuid.UUID `json:"geofence_id" validate:"required,uuid"`
	Latitude   float64   `json:"latitude" validate:"required,min=-90,max=90"`
	Longitude  float64   `json:"longitude" validate:"required,min=-180,max=180"`
}

CheckPointInGeofenceRequest represents a request to check if a point is within a geofence

type CreateGeofenceRequest

type CreateGeofenceRequest struct {
	Name       string            `json:"name" validate:"required,min=1,max=100"`
	Type       string            `json:"type_zone" validate:"required,oneof=safe danger normal"` // "type_zone" from frontend
	Color      string            `json:"color" validate:"required"`
	Features   []json.RawMessage `json:"features" validate:"required" swaggertype:"array,object"` // GeoJSON features
	SpaceID    *uuid.UUID        `json:"space_id,omitempty" validate:"omitempty,uuid"`
	IsActive   *bool             `json:"is_active,omitempty" example:"true"`
	Definition json.RawMessage   `json:"definition,omitempty" swaggertype:"object"`
}

CreateGeofenceRequest represents a request to create a new geofence

type CreateGeofenceResponse

type CreateGeofenceResponse struct {
	Message  string           `json:"message"`
	Geofence GeofenceResponse `json:"geofence"`
}

CreateGeofenceResponse represents response after creating a geofence

type CreateSpaceResponse

type CreateSpaceResponse struct {
	Message string        `json:"message"`
	Space   SpaceResponse `json:"space"`
}

CreateSpaceResponse represents response after creating a space

type DeleteGeofenceResponse

type DeleteGeofenceResponse struct {
	Message string `json:"message"`
}

DeleteGeofenceResponse represents response after deleting a geofence

type DeleteSpaceResponse

type DeleteSpaceResponse struct {
	Message string `json:"message"`
}

DeleteSpaceResponse represents response after deleting a space

type DeviceGeofenceResult

type DeviceGeofenceResult struct {
	DeviceID   string  `json:"device_id"`
	Latitude   float64 `json:"latitude"`
	Longitude  float64 `json:"longitude"`
	IsInside   bool    `json:"is_inside"`
	DistanceKm float64 `json:"distance_km"`
	Triggered  bool    `json:"triggered"`
	Reason     string  `json:"reason"`
}

DeviceGeofenceResult represents the geofence test result for a single device

type ErrorResponse

type ErrorResponse struct {
	Error   string `json:"error"`
	Message string `json:"message,omitempty"`
}

ErrorResponse represents an error response

type EventRuleInfo

type EventRuleInfo struct {
	EventRuleID string          `json:"event_rule_id"`
	RuleKey     string          `json:"rule_key"`
	Definition  json.RawMessage `json:"definition,omitempty" swaggertype:"object"`
	IsActive    bool            `json:"is_active"`
	CreatedAt   time.Time       `json:"created_at"`
}

EventRuleInfo represents basic event rule information

type FeatureProperties

type FeatureProperties struct {
	Mode string `json:"mode"`
}

type GeofenceDetailResponse

type GeofenceDetailResponse struct {
	GeofenceID  uuid.UUID       `json:"id"`
	Name        string          `json:"name"`
	TypeZone    string          `json:"type_zone"`
	Geometry    json.RawMessage `json:"geometry" swaggertype:"object"`
	EventRuleID *uuid.UUID      `json:"event_rule_id,omitempty"`
	IsActive    bool            `json:"is_active"`
	SpaceID     *uuid.UUID      `json:"space_id,omitempty"`
	CreatedAt   time.Time       `json:"created_at"`
	UpdatedAt   time.Time       `json:"updated_at"`

	// Space details
	Space     *SpaceItem  `json:"space,omitempty"`
	DeviceIDs []uuid.UUID `json:"device_ids,omitempty"` // Devices associated with this geofence
}

GeofenceDetailResponse represents a detailed geofence with additional info

type GeofenceFeature

type GeofenceFeature struct {
	ID       uuid.UUID       `json:"id"`
	Type     string          `json:"type"` // "Feature"
	Geometry json.RawMessage `json:"geometry" swaggertype:"object"`
}

GeofenceFeature represents a single polygon feature in a geofence

type GeofenceResponse

type GeofenceResponse struct {
	GeofenceID uuid.UUID         `json:"id"`
	Name       string            `json:"name"`
	TypeZone   string            `json:"type_zone"`
	Features   []json.RawMessage `json:"features" swaggertype:"array,object"`
	Color      string            `json:"color"`
	EventRule  *EventRuleInfo    `json:"event_rule,omitempty"`
	IsActive   bool              `json:"is_active"`
	SpaceID    *uuid.UUID        `json:"space_id,omitempty"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
}

GeofenceResponse represents a geofence in API responses

type GeofencesBySpaceResponse

type GeofencesBySpaceResponse struct {
	SpaceID string             `json:"space_id"`
	Results []GeofenceResponse `json:"results"`
	Count   int                `json:"count"`
}

GeofencesBySpaceResponse represents geofences associated with a space

type GetGeofencesBySpaceRequest

type GetGeofencesBySpaceRequest struct {
	SpaceID  uuid.UUID `param:"space_id" validate:"required,uuid"`
	IsActive *bool     `query:"is_active"`
}

GetGeofencesBySpaceRequest represents a request to get geofences associated with a space

type ListGeofencesRequest

type ListGeofencesRequest struct {
	SpaceID  *uuid.UUID `query:"space_id" validate:"omitempty,uuid"`
	IsActive *bool      `query:"is_active"`
	Search   string     `query:"search" validate:"omitempty"`
}

ListGeofencesRequest represents query parameters for listing geofences

type ListSpacesRequest

type ListSpacesRequest struct {
	IsActive  *bool `query:"is_active"`
	IsDefault *bool `query:"is_default"`
	Page      int   `query:"page" validate:"omitempty,min=1"`
	PageSize  int   `query:"page_size" validate:"omitempty,min=1,max=100"`
}

ListSpacesRequest represents query parameters for listing spaces

type PointInAnyGeofenceResponse

type PointInAnyGeofenceResponse struct {
	SpaceID   uuid.UUID                 `json:"space_id"`
	IsInside  bool                      `json:"is_inside"`
	Geofences []PointInGeofenceResponse `json:"geofences"`
	Count     int                       `json:"count"`
}

PointInAnyGeofenceResponse represents the result of checking if a point is in any geofence of a space

type PointInGeofenceResponse

type PointInGeofenceResponse struct {
	GeofenceID uuid.UUID `json:"id"`
	Name       string    `json:"name"`
	IsInside   bool      `json:"is_inside"`
}

PointInGeofenceResponse represents the result of a point-in-geofence check

type ResultResponse

type ResultResponse struct {
	Result string `json:"result"`
}

ResultResponse represents a result response

type SpaceItem

type SpaceItem struct {
	SpaceID   uuid.UUID `json:"space_id"`
	Name      string    `json:"name"`
	SpaceSlug string    `json:"space_slug"`
}

SpaceItem represents a minimal space info

type SpaceResponse

type SpaceResponse struct {
	SpaceID      uuid.UUID  `json:"space_id"`
	Name         string     `json:"name"`
	SpaceSlug    string     `json:"space_slug"`
	IsActive     bool       `json:"is_active"`
	TotalDevices *int       `json:"total_devices,omitempty"`
	Description  *string    `json:"description,omitempty"`
	CreatedBy    *uuid.UUID `json:"created_by,omitempty"`
	CreatedAt    time.Time  `json:"created_at"`
}

SpaceResponse represents a space in API responses

type SpacesListResponse

type SpacesListResponse struct {
	Spaces     []SpaceResponse `json:"spaces"`
	TotalCount int             `json:"total_count"`
	Page       int             `json:"page"`
	PageSize   int             `json:"page_size"`
}

SpacesListResponse represents a paginated list of spaces

type TestGeofenceRequest

type TestGeofenceRequest struct {
	Features   []json.RawMessage `json:"features" validate:"required"`  // Array of GeoJSON features
	TypeZone   string            `json:"type_zone" validate:"required"` // "safe", "danger", etc.
	Name       string            `json:"name,omitempty"`                // Optional name for display
	Definition json.RawMessage   `json:"definition,omitempty"`          // Optional condition definition
}

TestGeofenceRequest represents a request to test a geofence configuration against all devices in a space

type TestGeofenceResponse

type TestGeofenceResponse struct {
	Name      string                 `json:"name,omitempty"` // Optional name provided in request
	TypeZone  string                 `json:"type_zone"`      // Zone type from request
	Devices   []DeviceGeofenceResult `json:"devices"`        // Test results per device
	Total     int                    `json:"total"`          // Total devices tested
	Triggered int                    `json:"triggered"`      // Number of devices that triggered
}

TestGeofenceResponse represents the result of testing a geofence configuration against all devices

type UpdateGeofenceRequest

type UpdateGeofenceRequest struct {
	Name       *string           `json:"name,omitempty" validate:"omitempty,min=1,max=100" example:"Updated Area Name"`
	Type       *string           `json:"type_zone,omitempty" validate:"omitempty,oneof=safe danger normal"`
	Color      *string           `json:"color,omitempty" validate:"omitempty"`
	Features   []json.RawMessage `json:"features" validate:"required" swaggertype:"array,object"`
	SpaceID    *uuid.UUID        `json:"space_id,omitempty" validate:"omitempty,uuid"`
	IsActive   *bool             `json:"is_active,omitempty"`
	Definition json.RawMessage   `json:"definition,omitempty" swaggertype:"object"`
}

UpdateGeofenceRequest represents a request to update a geofence

type UpdateGeofenceResponse

type UpdateGeofenceResponse struct {
	Message  string           `json:"message"`
	Geofence GeofenceResponse `json:"geofence"`
}

UpdateGeofenceResponse represents response after updating a geofence

type UpdateSpaceResponse

type UpdateSpaceResponse struct {
	Message string        `json:"message"`
	Space   SpaceResponse `json:"space"`
}

UpdateSpaceResponse represents response after updating a space

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL