package chips

type GuacClientOptions struct {
	MaxInactivityTime          int                        `json:"max_inactivity_time"`
	Crypt                      CryptoOptions              `json:"crypt"`
	DefaultConnectionSettings  ConnectionSettings         `json:"default_connection_settings"`
	AllowedUnencryptedSettings AllowedUnencryptedSettings `json:"allowed_unencrypted_settings"`
}

type CryptoOptions struct {
	Cipher string `json:"cipher"`
	Key    string `json:"key"`
}

type ConnectionSettings struct {
	RDP    map[string]interface{} `json:"rdp"`
	VNC    map[string]interface{} `json:"vnc"`
	SSH    map[string]interface{} `json:"ssh"`
	Telnet map[string]interface{} `json:"telnet"`
	Join   map[string]interface{} `json:"join"`
}

type AllowedUnencryptedSettings struct {
	RDP    []string `json:"rdp"`
	VNC    []string `json:"vnc"`
	SSH    []string `json:"ssh"`
	Telnet []string `json:"telnet"`
	Join   []string `json:"join"`
}

var defaultGuacClientOptions = GuacClientOptions{
	MaxInactivityTime: 10000,
	Crypt: CryptoOptions{
		Cipher: "AES-256-CBC",
	},
	DefaultConnectionSettings: ConnectionSettings{
		RDP: map[string]interface{}{
			"port":     "3389",
			"width":    1024,
			"height":   768,
			"dpi":      96,
			"audio":    []string{"audio/L16"},
			"video":    nil,
			"image":    []string{"image/png", "image/jpeg"},
			"timezone": nil,
		},
		VNC: map[string]interface{}{
			"port":     "5900",
			"width":    1024,
			"height":   768,
			"dpi":      96,
			"audio":    []string{"audio/L16"},
			"video":    nil,
			"image":    []string{"image/png", "image/jpeg"},
			"timezone": nil,
		},
		SSH: map[string]interface{}{
			"port":     22,
			"width":    1024,
			"height":   768,
			"dpi":      96,
			"audio":    []string{"audio/L16"},
			"video":    nil,
			"image":    []string{"image/png", "image/jpeg"},
			"timezone": nil,
		},
		Telnet: map[string]interface{}{
			"port":     23,
			"width":    1024,
			"height":   768,
			"dpi":      96,
			"audio":    []string{"audio/L16"},
			"video":    nil,
			"image":    []string{"image/png", "image/jpeg"},
			"timezone": nil,
		},
		Join: map[string]interface{}{
			"width":    1024,
			"height":   768,
			"dpi":      96,
			"audio":    []string{"audio/L16"},
			"video":    nil,
			"image":    []string{"image/png", "image/jpeg"},
			"timezone": nil,
		},
	},
	AllowedUnencryptedSettings: AllowedUnencryptedSettings{
		Join: []string{
			"width",
			"height",
			"dpi",
			"audio",
			"video",
			"image",
			"timezone",
			"GUAC_AUDIO", // backwards compatibility
			"GUAC_VIDEO", // backwards compatibility
		},
		RDP: []string{
			"width",
			"height",
			"dpi",
			"audio",
			"video",
			"image",
			"timezone",
			"GUAC_AUDIO", // backwards compatibility
			"GUAC_VIDEO", // backwards compatibility
		},
		VNC: []string{
			"width",
			"height",
			"dpi",
			"audio",
			"video",
			"image",
			"timezone",
			"GUAC_AUDIO", // backwards compatibility
			"GUAC_VIDEO", // backwards compatibility
		},
		SSH: []string{
			"color-scheme",
			"font-name",
			"font-size",
			"width",
			"height",
			"dpi",
			"audio",
			"video",
			"image",
			"timezone",
			"GUAC_AUDIO", // backwards compatibility
			"GUAC_VIDEO", // backwards compatibility
		},
		Telnet: []string{
			"color-scheme",
			"font-name",
			"font-size",
			"width",
			"height",
			"dpi",
			"audio",
			"video",
			"image",
			"timezone",
			"GUAC_AUDIO", // backwards compatibility
			"GUAC_VIDEO", // backwards compatibility
		},
	},
}

type TokenObject struct {
	ConnType string                 `json:"connection_type"`
	Id       string                 `json:"id,omitzero"`
	Settings map[string]interface{} `json:"settings"`
}

// const tokenObject = {
//   connection: {
//     type: "rdp",
//     settings: {
//       "hostname": "10.0.0.12",
//       "username": "Administrator",
//       "password": "pAsSwOrD",
//       "enable-drive": true,
//       "create-drive-path": true,
//       "security": "any",
//       "ignore-cert": true,
//       "enable-wallpaper": false
//     }
//   }
// };
