// -*- c++ -*-

#ifndef __POLICY_IDL__
#define __POLICY_IDL__

#include "config.idl"

#include <mico/ir.idl>
#include <mico/current.idl>

#pragma prefix "omg.org"

module CORBA {

  typedef unsigned long PolicyType;

  interface Policy {
    readonly attribute PolicyType policy_type;
    Policy copy ();
    void destroy ();
  };

  typedef sequence<Policy> PolicyList;
  typedef sequence<PolicyType> PolicyTypeSeq;

  exception InvalidPolicies {
    sequence <unsigned short> indices;
  };

  enum SetOverrideType {
      SET_OVERRIDE,
      ADD_OVERIDE
  };

  local interface PolicyManager {
    PolicyList get_policy_overrides(in PolicyTypeSeq ts);
    void set_policy_overrides(in PolicyList policies,
                              in SetOverrideType set_add)
      raises (InvalidPolicies);
  };

  local interface PolicyCurrent : PolicyManager, Current {
  };

  interface DomainManager {
    Policy get_domain_policy (in PolicyType policy_type);
    void set_domain_policy (in Policy policy);
    DomainManager copy ();
  };

  const PolicyType SecConstruction = 11;

  interface ConstructionPolicy : Policy {
    void make_domain_manager (in CORBA::InterfaceDef object_type,
			      in boolean constr_policy);
    boolean constr_policy (in Object _object);
  };

  typedef sequence<DomainManager> DomainManagerList;

  typedef short PolicyErrorCode;
  const PolicyErrorCode BAD_POLICY = 0;
  const PolicyErrorCode UNSUPPORTED_POLICY = 1;
  const PolicyErrorCode BAD_POLICY_TYPE = 2;
  const PolicyErrorCode BAD_POLICY_VALUE = 3;
  const PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4;

  exception PolicyError {
      PolicyErrorCode reason;
  };
};

#endif // __POLICY_IDL__
