// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/ErrorExplanation.java
// public class ErrorExplanation {
//     private final Type type;
//     private final String message;
// 
//     public enum Type {
//         ExternalError("external-error"),
//         InteractionExplired("interaction-expired"),
//         InternalError("internal-error"),
//         InvalidMessage("invalid-message"),
//         NotImplemented("not-implemented"),
//         Unavailable("unavailable");
// 
//         private final String fipaName;
// 
//         private Type(final String fipaName) {
//             this.fipaName = fipaName;
//         }
// 
//         public String getFipaName() {
//             return fipaName;
//         }
// 
//         public static Type getByFipaName(final String fipaName) {
//             for (Type t : values()) {
//                 if (t.fipaName.equals(fipaName)) {
//                     return t;
//                 }
//             }
// 
//             return null;
//         }
//     }
// 
//     public ErrorExplanation(final Type type,
//                             final String message) {
//         this.type = type;
//         this.message = message;
// 
//         if (null == type) {
//             throw new IllegalArgumentException("null type");
//         }
// 
//         if (null == message) {
//             throw new IllegalArgumentException("null message");
//         }
// 
//         if (0 == message.length()) {
//             throw new IllegalArgumentException("empty message");
//         }
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String toString() {
//         return type + " (" + message + ")";
//     }
// }


import net.fortytwo.rdfagents.model.ErrorExplanation;
package net.fortytwo.rdfagents.messaging;


/**
 * A commitment (or lack thereof) to answer a query or accept a subscription.
 * A query may either be answered immediately
 * (in which case the response to the initiator consists of the query result),
 * or at some later point in time
 * (in which case an "agree" message is first sent to the initiator,
 * to be followed by another message with the query result).
 * Subscription requests must always be met with either an "agree" or a "refuse" message, before any updates are sent.
 *
 * @author Joshua Shinavier (http://fortytwo.net)
 */
public class Commitment {

    public enum Decision {
        AGREE_AND_NOTIFY,  // Query and Subscribe
        AGREE_SILENTLY,    // Query only
        REFUSE             // Query and Subscribe
    }

    private final Decision decision;
// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/model/ErrorExplanation.java
// public class ErrorExplanation {
//     private final Type type;
//     private final String message;
// 
//     public enum Type {
//         ExternalError("external-error"),
//         InteractionExplired("interaction-expired"),
//         InternalError("internal-error"),
//         InvalidMessage("invalid-message"),
//         NotImplemented("not-implemented"),
//         Unavailable("unavailable");
// 
//         private final String fipaName;
// 
//         private Type(final String fipaName) {
//             this.fipaName = fipaName;
//         }
// 
//         public String getFipaName() {
//             return fipaName;
//         }
// 
//         public static Type getByFipaName(final String fipaName) {
//             for (Type t : values()) {
//                 if (t.fipaName.equals(fipaName)) {
//                     return t;
//                 }
//             }
// 
//             return null;
//         }
//     }
// 
//     public ErrorExplanation(final Type type,
//                             final String message) {
//         this.type = type;
//         this.message = message;
// 
//         if (null == type) {
//             throw new IllegalArgumentException("null type");
//         }
// 
//         if (null == message) {
//             throw new IllegalArgumentException("null message");
//         }
// 
//         if (0 == message.length()) {
//             throw new IllegalArgumentException("empty message");
//         }
//     }
// 
//     public Type getType() {
//         return type;
//     }
// 
//     public String getMessage() {
//         return message;
//     }
// 
//     public String toString() {
//         return type + " (" + message + ")";
//     }
// }


// Path: rdfagents-core/src/main/java/net/fortytwo/rdfagents/messaging/Commitment.java
import net.fortytwo.rdfagents.model.ErrorExplanation;

package net.fortytwo.rdfagents.messaging;


/**
 * A commitment (or lack thereof) to answer a query or accept a subscription.
 * A query may either be answered immediately
 * (in which case the response to the initiator consists of the query result),
 * or at some later point in time
 * (in which case an "agree" message is first sent to the initiator,
 * to be followed by another message with the query result).
 * Subscription requests must always be met with either an "agree" or a "refuse" message, before any updates are sent.
 *
 * @author Joshua Shinavier (http://fortytwo.net)
 */
public class Commitment {

    public enum Decision {
        AGREE_AND_NOTIFY,  // Query and Subscribe
        AGREE_SILENTLY,    // Query only
        REFUSE             // Query and Subscribe
    }

    private final Decision decision;
    private final ErrorExplanation explanation;