using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NodeNetwork
{
///
/// A class that represents a generic validation result.
///
public abstract class ValidationResult
{
///
/// True if the subject is valid
///
public bool IsValid { get; }
///
/// A viewmodel of the message that is to be displayed explaining this validation result.
///
public object MessageViewModel { get; }
protected ValidationResult(bool isValid, object messageViewModel)
{
this.IsValid = isValid;
this.MessageViewModel = messageViewModel;
}
}
///
/// A validation of the node network.
///
public class NetworkValidationResult : ValidationResult
{
///
/// If false, the network is in a state where trying to parse it (by walking from node to node) can cause problems.
/// For example, this property is false if the network contains loops since parsing it could then result in infinite loops.
///
public bool NetworkIsTraversable { get; }
public NetworkValidationResult(bool isValid, bool isTraversable, object messageViewModel) : base(isValid, messageViewModel)
{
NetworkIsTraversable = isTraversable;
}
}
///
/// A validation of a connection between nodes.
///
public class ConnectionValidationResult : ValidationResult
{
public ConnectionValidationResult(bool isValid, object messageViewModel) : base(isValid, messageViewModel)
{
}
}
}