module DialogueUtilities

import StdEnv
import Diagnostics

Start
	=	17

import	StdDialog

:: *DialogueIds	:== Int

NewDialogueIds :: DialogueIds
NewDialogueIds
	=	0

Don`tCare	:==	0

:: DialogueDefinition *prog =
	{
		title
			:: DialogTitle,
		attributes
			:: [DialogAttribute],
		items
			:: [],
		buttonIds
			:: Int
	}

NewDialogueDefinition :: {#Char} [DialogAttribute] -> DialogueDefinition *programState
NewDialogueDefinition title attributes =
	{
		title
			=	title,
		attributes
			=	attributes,
		items
			=	[],
		buttonIds
			=	0
	}

class StateWithDialogueIds .a
where
	GetDialogueIds :: a -> (DialogueIds, a)
	PutDialogueIds :: DialogueIds a -> a

OpenDialogue :: (DialogueDefinition *prog) *prog (IOState *prog) -> (*prog, IOState *prog) | DialogueIds prog
OpenDialogue def prog io
	# (ids, prog)
		=	GetDialogueIds prog
	# (id, ids)
		=	NextDialogueId id
	# prog
		=	PutDialogueIds prog
	=	(prog, io)

// CloseDialogue :: DialogueIncarnation

/*
Button :: {#Char} 
Title ::  {#Char} ItemPos -> DialogItem s (IOState s)

class Dialogue a
where
	PutValues :: a Dialogue -> Dialogue
	GetValues :: a -> (a, Dialogue)


class NewDialogue :: a -> 

*/