namespace Hydra.Framework.Validation
{
    /// <summary>
    /// Invalid format violation
    /// </summary>
    public class InvalidFormatViolation
        : IViolation
    {
        #region Member Variables
        /// <summary>
        /// name of the Property
        /// </summary>
        private readonly string propertyName;

        /// <summary>
        /// Violoation Message
        /// </summary>
        private readonly string violationMessage;
        #endregion

        #region Constructors
        /// <summary>
        /// Initializes a new instance of the <see cref="InvalidFormatViolation"/> class.
        /// </summary>
        /// <param name="propertyName">StateName of the property.</param>
        public InvalidFormatViolation(string propertyName)
        {
            this.propertyName = propertyName;
            this.violationMessage = "is improperly formatted";
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="InvalidFormatViolation"/> class.
        /// </summary>
        /// <param name="propertyName">StateName of the property.</param>
        /// <param name="message">The message.</param>
        public InvalidFormatViolation(string propertyName, string message)
        {
            this.propertyName = propertyName;
            this.violationMessage = message;
        }
        #endregion

        #region Overrides
        /// <summary>
        /// Returns a <see cref="System.String"/> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String"/> that represents this instance.
        /// </returns>
        public override string ToString()
        {
            return string.Format("{0} {1}", propertyName, violationMessage);
        }
        #endregion
    }
}