//#include "policy.idl"
#include "security.idl"

module SecurityDomain {

    typedef string Istring;

    struct NameComponent {
 	Istring id;
 	Istring kind;
    };

    typedef sequence <NameComponent> Name;
    typedef sequence <Name> NameList;
    // typedef unsigned short PolicyCombinator;
 
    enum CombinatorSetType {
 	_Union,
 	Intersection,
 	Negation,
 	FirstFit
    };

    typedef CombinatorSetType PolicyCombinator;

    struct CombinatorInfo {
 	CORBA::PolicyType policy_type;
 	CombinatorSetType combinator;
    };
 
    typedef sequence<CombinatorInfo> CombinatorInfoList;
 
    interface NameIterator;
    interface DomainManagerAdmin;

    typedef sequence<DomainManagerAdmin> DomainManagerAdminList;

    interface DomainManagerFactory {
	DomainManagerAdmin get_root_domain_manager(in Istring type);
	void add_root_domain_manager(in Istring type);
	DomainManagerAdmin create_domain_manager();
	void release_domain_manager(in DomainManagerAdmin domainManager);
	// extension
	boolean load_config_file(in string filename, in Istring type);
    };
 
    interface DomainManagerAdmin {//  CORBA::DomainManager {
	void set_domain_policy(in CORBA::Policy policy);
	CORBA::Policy get_domain_policy(in CORBA::PolicyType policyType);
	void delete_domain_policy(in CORBA::PolicyType policyType);
	Name get_name();
	void set_name(in Name name);
	DomainManagerAdminList get_parent_domain_managers();
	void set_parent_domain_managers(in DomainManagerAdminList managers);
	DomainManagerAdminList get_child_domain_managers();
    };

    interface DomainAuthority : DomainManagerAdmin {
 	boolean is_root();
	boolean exists();
	PolicyCombinator get_policy_combinator(in CORBA::PolicyType policyType);
	PolicyCombinator get_policy_combinator_for_multi_parents(in CORBA::PolicyType policyType,
								 in DomainManagerAdmin parent);
	NameIterator get_child_domain_names();
	Name get_domain_name(in DomainManagerAdmin domainManager);
	DomainManagerAdmin get_domain_manager(in Name domainName);
    };


    interface DomainAuthorityAdmin : DomainAuthority {
	void add_domain_manager(in DomainManagerAdmin domainManager,
				in Name domainName);
	void remove_domain_manager(in DomainManagerAdmin child);
	void set_policy_combinator(in CORBA::PolicyType policyType,
				   in PolicyCombinator combinator);
	void set_policy_combinator_for_multi_parents(in CORBA::PolicyType policyType,
						     in PolicyCombinator combinator,
						     in DomainManagerAdmin parent);
    };

    interface NameIterator {
	boolean next_one(out Name domainName);
	void destroy();
    };
 
    interface NameExt {
	string to_string(in Name domainName);
	Name to_name(in string urlName);
    };
};






