﻿using System;
using System.Linq;

namespace Meow.Diagnostic
{
    public interface IResult
    {
        string Name { get; set; }
        DateTime? Start { get; set; }
        DateTime? Stop { get; set; }
        TimeSpan? Duration { get; }
        string Info { get; }
        Status Status { get; set; }
    }

    public class Result : IResult
    {
        public string Name { get; set; }
        public DateTime? Start { get; set; }
        public DateTime? Stop { get; set; }
        public TimeSpan? Duration { get { return Stop - Start; } }
        public string Info { get; set; }
        public Status Status { get; set; }

        public Result(Status status, string info)
        {
            Status = status;
            Info = info;
        }
    }

    public class PassResult : Result
    {
        public PassResult()
            : base(Status.Pass, string.Empty)
        { }

        public PassResult(string info)
            : base(Status.Pass, info)
        { }
    }

    public class WarnResult : Result
    {
        public WarnResult()
            : base(Status.Warn, string.Empty)
        { }

        public WarnResult(string info)
            : base(Status.Warn, info)
        { }
    }

    public class FailResult : Result
    {
        public FailResult()
            : base(Status.Fail, string.Empty)
        { }

        public FailResult(string info)
            : base(Status.Fail, info)
        { }
    }

    public class InconclusiveResult : Result
    {
        public InconclusiveResult()
            : base(Status.Inconclusive, string.Empty)
        { }

        public InconclusiveResult(string info)
            : base(Status.Inconclusive, info)
        { }
    }
}