// Copyright © Selmo Technology GmbH. All Rights Reserved

using Novus.Shared.Types.IssueHandling;

namespace SelmoStudio.Hmi.Server.TestSetup
{
    internal class TestIssuesBuilder
    {
        private static int _issuesMessageCounter = 1;

        private static List<Issue> _issues;

        internal TestIssuesBuilder()
        {
            _issues = new List<Issue>();
        }

        internal TestIssuesBuilder WithUnknownIssues()
        {
            _issues.Add(Issue.Error(new IssueId(Guid.NewGuid()), $"Error message {_issuesMessageCounter}."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.NewGuid()), $"Fatal message {_issuesMessageCounter}."));

            _issuesMessageCounter++;

            return this;
        }

        internal TestIssuesBuilder WithWellKnownIssues()
        {
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("128fbbab-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.Parse("a47f4fa3-4aaa-4236-bc1d-ae8d4716c051")), $"This is a well known fatal error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("228fbbbb-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.Parse("b47f4fb3-4aaa-4236-bc1d-ae8d4716c051")), $"This is a well known fatal error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("328fbbcb-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.Parse("c47f4fc3-4aaa-4236-bc1d-ae8d4716c051")), $"This is a well known fatal error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("428fbbdb-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.Parse("d47f4fd3-4aaa-4236-bc1d-ae8d4716c051")), $"This is a well known fatal error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("528fbbeb-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Fatal(new IssueId(Guid.Parse("e47f4fe3-4aaa-4236-bc1d-ae8d4716c051")), $"This is a well known fatal error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));
            _issues.Add(Issue.Error(new IssueId(Guid.Parse("628fbbfb-76a9-45d5-9799-e22e098bb364")), $"This is a well known error {_issuesMessageCounter}." +
                $" Second sentence is long. The third sentence is even longer."));

            _issuesMessageCounter++;

            return this;
        }

        internal IEnumerable<Issue> Build()
        {
            return _issues;
        }
    }
}