//-----------------------------------------------------------------------
//
// Copyright (c) Outercurve Foundation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace DotNetOpenAuth.Messaging {
using System;
using System.Collections.Generic;
using Validation;
///
/// A tool to analyze an incoming message to figure out what concrete class
/// is designed to deserialize it and instantiates that class.
///
public interface IMessageFactory {
///
/// Analyzes an incoming request message payload to discover what kind of
/// message is embedded in it and returns the type, or null if no match is found.
///
/// The intended or actual recipient of the request message.
/// The name/value pairs that make up the message payload.
///
/// A newly instantiated -derived object that this message can
/// deserialize to. Null if the request isn't recognized as a valid protocol message.
///
IDirectedProtocolMessage GetNewRequestMessage(MessageReceivingEndpoint recipient, IDictionary fields);
///
/// Analyzes an incoming request message payload to discover what kind of
/// message is embedded in it and returns the type, or null if no match is found.
///
///
/// The message that was sent as a request that resulted in the response.
///
/// The name/value pairs that make up the message payload.
///
/// A newly instantiated -derived object that this message can
/// deserialize to. Null if the request isn't recognized as a valid protocol message.
///
IDirectResponseProtocolMessage GetNewResponseMessage(IDirectedProtocolMessage request, IDictionary fields);
}
}