package protocol

const ProtocolVersion = "1.0"

type Event struct {
	Type      string      `json:"type"`
	Timestamp int64       `json:"timestamp"`
	DeviceID  string      `json:"deviceId"`
	SessionID string      `json:"sessionId"`
	Payload   interface{} `json:"payload"`
}

const (
	EventLogcat          = "logcat"
	EventNetworkRequest  = "network.request"
	EventNetworkResponse = "network.response"
	EventPrefsUpdate     = "prefs.update"
	EventFileList        = "file.list"
	EventDeviceInfo      = "device.info"
)

type LogcatPayload struct {
	Tag      string `json:"tag"`
	Priority string `json:"priority"`
	Message  string `json:"message"`
	PID      int    `json:"pid"`
}

type NetworkRequestPayload struct {
	RequestID string            `json:"requestId"`
	URL       string            `json:"url"`
	Method    string            `json:"method"`
	Headers   map[string]string `json:"headers"`
	Body      string            `json:"body,omitempty"`
}

type NetworkResponsePayload struct {
	RequestID  string            `json:"requestId"`
	StatusCode int               `json:"statusCode"`
	Headers    map[string]string `json:"headers"`
	Body       string            `json:"body,omitempty"`
	Size       int64             `json:"size"`
	DurationMs int64             `json:"durationMs"`
}

type PrefsUpdatePayload struct {
	File  string            `json:"file"`
	Prefs map[string]string `json:"prefs"`
}

type DeviceInfoPayload struct {
	Manufacturer string `json:"manufacturer"`
	Model        string `json:"model"`
	AndroidVersion string `json:"androidVersion"`
	ABI          string `json:"abi"`
	RAM          int64  `json:"ram"`
}
