package n9m

func (e *Package) RequestConnect(session string, serial string, numOfCams int) {
	e.Payload = map[string]any{
		"MODULE":    "CERTIFICATE",
		"OPERATION": "CONNECT",
		"PARAMETER": map[string]any{
			"DSNO":    serial,
			"CHANNEL": numOfCams,
		},
		"SESSION": session,
	}
}

// video server util
func (e *Package) ResponseConnect(Sid string, streamName string) {
	e.Payload = map[string]any{
		"MODULE":    "CERTIFICATE",
		"OPERATION": "CREATESTREAM",
		"RESPONSE": map[string]any{
			"ERRORCODE":  0,
			"STREAMNAME": streamName,
		},
		"SESSION": Sid,
	}
}

// main server util
func (e *Package) ResponseCertificateConnect(Sid string) {
	e.Payload = map[string]any{
		"MODULE":    "CERTIFICATE",
		"OPERATION": "CONNECT",
		"RESPONSE": map[string]any{
			"ERRORCAUSE": "",
			"ERRORCODE":  0,
			"MASKCMD":    5,
			"PRO":        "1.0.5",
		},
		"SESSION": Sid,
	}
}