// Module definition for umf.test1 master program
// Copyright 2002 Tech-Know-Ware Ltd

module umf.test1

struct umf-test
{
	Identity		identity as ?;
	Transaction		transaction[1..*] as T;
};

struct Identity
{
	ascii			host as ?;
	int<0..65535>	port[1..5] as ?;
};

union Transaction
{
	TRequest			request as TR;
	TReject				reject as TRj;
	umf.test2::TTest	test as Test;
};

struct TRequest
{
	int<0..65535>	id as ?;
	Action			action as A;
};

struct Action
{
	int<0..65535>	context-id as ?;
	CommandRequest	cmd[1..*];
};

struct CommandRequest
{
	Operation				operation as ?;
	ascii<1..128>			line-name as ?;
	RequestParameters		parameters as p;
};

union Operation
{
	void			add;
	void			service-change as sc;
	void			modify;
};

struct TReject
{
	int<0..65535>	id as ?;
	ActionReject	action-reject as ARj;
};

struct RequestParameters
{
	struct end-device[0..1]
		{
		ascii		line-name as ?;
		};
	int<0..9999999>	service-descriptor[0..1] as SCD;
	union service-change-mode[0..1] as SCM
		{
		void		forced;
		};
};


struct ActionReject
{
	int<0..65535>	context-id as ?;
	CommandReject	CRj[1..*];
};

struct CommandReject
{
	Operation				operation as ?;
	RejectReason			reject-reason as ?;
	int<0..9999999>			association as id;
	ascii<1..128>			line-id as id;
};

struct RejectReason
{
	int<100..999>			code as ?;
	ascii<0..128>			description as ?;
};


/*
Example:

{ myco.com 50000, 40000, 30000 } 
	T =  
		TR = { 543345
				A = { 
					325465 
					cmd = { add 'Line 1' p = { ED = { 'Off-hook' } } }
					, { sc 'Line 2' p = { SCD = 3245345 SCM = forced } }
				}
	
		}
	, 
		TRj = { 4322345 
				ARj = { 3256443 CRj = { modify { 501 'Not Implemented' } id = 543227 } }
			}
	,  // This is a comment
		Test = { 12 24 volume = 14 
				addr = IPv4 = 212.10.18.4 dyn = 'Dynamic' uni = "Unicode" 
				embed = ( { myco.com 50000 } name = 'Pete Cordell (Developer\)' )
				bool = True
				binary = ^QWxhZGRpbjpvcGVuIHNlc2FtZQ==
				bool = FALSE
				date = 2000-04-07
				time = 16:40:18.1000000 // This is an invalid time
				time2 = 16:40:18
				time3 = 16:40
				}
}

*/