package models import ( "time" ) // BoundDevice represents a physical Spark ("微光") recording device bound to a user type BoundDevice struct { ID string `gorm:"type:uuid;primaryKey;default:gen_random_uuid()" json:"id"` UserID string `gorm:"type:uuid;not null;index;uniqueIndex:idx_device_user_peripheral" json:"userId"` Name string `gorm:"size:100;not null" json:"name"` PeripheralUUID string `gorm:"size:100;uniqueIndex:idx_device_user_peripheral" json:"peripheralUUID"` HardwareMAC string `gorm:"size:100" json:"hardwareMAC"` BatteryLevel int `gorm:"default:100" json:"batteryLevel"` FirmwareVersion string `gorm:"size:50;default:'v1.2.0'" json:"firmwareVersion"` FreeStorageMB int `gorm:"default:12000" json:"freeStorageMB"` TotalStorageMB int `gorm:"default:16000" json:"totalStorageMB"` IsConnected bool `gorm:"default:false" json:"isConnected"` BoundAt time.Time `gorm:"autoCreateTime" json:"boundAt"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updatedAt"` } type BindDeviceRequest struct { Name string `json:"name" binding:"required"` PeripheralUUID string `json:"peripheralUUID"` HardwareMAC string `json:"hardwareMAC"` FirmwareVersion string `json:"firmwareVersion"` BatteryLevel *int `json:"batteryLevel,omitempty"` FreeStorageMB *int `json:"freeStorageMB,omitempty"` TotalStorageMB *int `json:"totalStorageMB,omitempty"` } type UpdateDeviceRequest struct { Name *string `json:"name,omitempty"` BatteryLevel *int `json:"batteryLevel,omitempty"` IsConnected *bool `json:"isConnected,omitempty"` FirmwareVersion *string `json:"firmwareVersion,omitempty"` FreeStorageMB *int `json:"freeStorageMB,omitempty"` TotalStorageMB *int `json:"totalStorageMB,omitempty"` }