// Copyright © Selmo Technology GmbH. All Rights Reserved

using Microsoft.AspNetCore.Components;
using Microsoft.Extensions.Localization;
using Novus.Shared.Types.IssueHandling;
using SelmoStudio.Hmi.Server.Shared.Resources;

namespace SelmoStudio.Hmi.Server.SelmoHmi.Issues.Components
{
    public partial class IssueReportDialogComponent
    {
        [Inject]
        private IStringLocalizer<HmiResource> Localizer { get; set; }

        [Parameter]
        public bool UseConditionalFormatting { get; set; }

        [Parameter]
        public IEnumerable<Issue> Issues { get; set; }

        [Parameter]
        public bool UnknownIssueOccured { get; set; }

        [Parameter]
        public string ContinueButtonContent { get; set; }

        [Parameter]
        public string DiagnoseButtonContent { get; set; }

        [Parameter]
        public string DiagnoseUrl { get; set; }

        protected override void OnParametersSet()
        {
            if (string.IsNullOrEmpty(ContinueButtonContent))
            {
                ContinueButtonContent = Localizer[nameof(HmiResource.Continue)];
            }

            if (string.IsNullOrEmpty(DiagnoseButtonContent))
            {
                DiagnoseButtonContent = Localizer[nameof(HmiResource.Diagnose)];
            }

            base.OnParametersSet();
        }
    }
}