// This file is part of Gopher2600.
//
// Gopher2600 is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Gopher2600 is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Gopher2600.  If not, see <https://www.gnu.org/licenses/>.

package gui

// GUI defines the operations that can be performed on visual user interfaces.
type GUI interface {
	// Send a request to set a GUI feature. Returns an error so that it can be
	// shown in the appropriate context (terminal or the log depending on what
	// was being requested)
	SetFeature(request FeatureReq, args ...FeatureReqData) error
}

// FeatureReq is used to request the setting of a gui attribute eg. toggling the overlay.
type FeatureReq string

// FeatureReqData represents the information associated with a FeatureReq. See
// commentary for the defined FeatureReq values for the underlying type.
type FeatureReqData interface{}

// List of valid feature requests. argument must be of the type specified or
// else the interface{} type conversion will fail and the application will
// probably crash.
//
// Note that, like the name suggests, these are requests, they may or may not
// be satisfied depending other conditions in the GUI.
const (
	// notify gui of the underlying emulation mode.
	ReqSetEmulationMode FeatureReq = "ReqSetEmulationMode" // govern.Mode

	// program is ending. gui should do anything required before final exit.
	ReqEnd FeatureReq = "ReqEnd" // nil

	// put gui output into full-screen mode (ie. no window border and content
	// the size of the monitor).
	ReqFullScreen FeatureReq = "ReqFullScreen" // bool

	// an event generated by the cartridge has occured. for example, network
	// activity from a PlusROM cartridge.
	ReqNotification FeatureReq = "ReqNotification" // notifications.Notify

	// peripheral has been changed for one of the ports.
	ReqPeripheralPlugged FeatureReq = "ReqPeripheralPlugging" // plugging.PortID, plugging.PeripheralID

	// open ROM selector.
	ReqROMSelector FeatureReq = "ReqROMSelector" // nil

	// request for a comparison window to be opened.
	ReqComparison FeatureReq = "ReqComparison" // chan *image.RGBA, chan *image.RGBA

	// request for bot features to be enabled. a nil argument will cause the
	// bot features to be removed.
	ReqBotFeedback FeatureReq = "ReqBotFeedback" // *bots.Feedback

	// request for the coprocess source window to open at the specified line
	ReqCoProcSourceLine FeatureReq = "ReqCoProcSourceLine" // *developer.SourceLine

	// request a screenshot to be taken
	// optional argument is the filename for the screenshot
	ReqScreenshot FeatureReq = "ReqScreenshot" // [optional] filename
)
