// Copyright (C) Stichting Deltares 2025. All rights reserved.
//
// This file is part of the Dam Engine.
//
// The Dam Engine is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
//
// All names, logos, and references to "Deltares" are registered trademarks of
// Stichting Deltares and remain full property of Stichting Deltares at all times.
// All rights reserved.
using System.Collections.Generic;
using Deltares.DamEngine.Data.Standard.Language;
using Deltares.DamEngine.Data.Standard.Validation;
namespace Deltares.DamEngine.Data.General;
///
/// Represents the calculation specifications at project level for DAM.
/// These are the main choices that specify the calculation
///
public class DamProjectCalculationSpecification
{
private DamFailureMechanismeCalculationSpecification currentSpecification;
///
/// Initializes a new instance of the class.
///
public DamProjectCalculationSpecification()
{
DamCalculationSpecifications = new List();
//waterLevelTimeSeriesFileName = @"d:\src\delftgeosystems\trunk\data\Dam\RRD\Groot Salland\DAM UI Testdata\inputshortstart_dam.xml";
}
///
/// Gets the dam calculation specifications.
///
///
/// The dam calculation specifications.
///
[Validate]
public List DamCalculationSpecifications { get; }
///
/// Gets or sets the analysis type for serialization purpose only.
/// This "dummy" property is and must be only used for serialization/deserialization purposes as the real static property
/// SelectedAnalysisType is NOT serialized. This is way its name is deliberately strange.
///
///
/// The analysis type for serialization purpose only.
///
public AnalysisType AnalysisTypeForSerializationPurposeOnly
{
get
{
return SelectedAnalysisType;
}
set
{
SelectedAnalysisType = value;
}
}
///
/// Gets or sets the type of the selected analysis.
///
///
/// The type of the selected analysis.
///
public static AnalysisType SelectedAnalysisType { get; set; } = AnalysisType.AdaptGeometry;
///
/// Gets or sets the current specification.
///
///
/// The current specification.
///
public DamFailureMechanismeCalculationSpecification CurrentSpecification
{
get
{
if (currentSpecification == null && DamCalculationSpecifications.Count > 0)
{
currentSpecification = DamCalculationSpecifications[0];
}
return currentSpecification;
}
set
{
currentSpecification = value;
}
}
///
/// Validates this instance.
///
///
[Validate]
public ValidationResult[] Validate()
{
if (DamCalculationSpecifications.Count > 1)
{
return new[]
{
new ValidationResult(ValidationResultType.Error, LocalizationManager.GetTranslatedText(this, "MaxOneCalculationSpecification"),
this)
};
}
return new ValidationResult[0];
}
}