Moved some classes around to the domain layer.
This commit is contained in:
9
JSMR.Domain/Enums/TranslationKind.cs
Normal file
9
JSMR.Domain/Enums/TranslationKind.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
namespace JSMR.Domain.Enums;
|
||||
|
||||
[Flags]
|
||||
public enum TranslationKind
|
||||
{
|
||||
None = 0,
|
||||
Official = 1,
|
||||
Recommended = 2
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using JSMR.Domain.Enums;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace JSMR.Domain.ValueObjects;
|
||||
|
||||
@@ -26,14 +27,14 @@ public sealed record SupportedLanguage(string Code, Language Language)
|
||||
private static readonly Dictionary<Language, SupportedLanguage> _byLang =
|
||||
All.ToDictionary(x => x.Language);
|
||||
|
||||
public static bool TryFromCode(string code, out SupportedLanguage? supportedLanguage) =>
|
||||
public static bool TryFromCode(string code, [MaybeNullWhen(false)] out SupportedLanguage supportedLanguage) =>
|
||||
_byCode.TryGetValue(code, out supportedLanguage);
|
||||
|
||||
public static bool TryFromLanguage(Language lang, out SupportedLanguage? supportedLanguage) =>
|
||||
_byLang.TryGetValue(lang, out supportedLanguage);
|
||||
public static bool TryFromLanguage(Language language, [MaybeNullWhen(false)] out SupportedLanguage supportedLanguage) =>
|
||||
_byLang.TryGetValue(language, out supportedLanguage);
|
||||
|
||||
public static SupportedLanguage FromLanguage(Language language) =>
|
||||
_byLang.TryGetValue(language, out var sl)
|
||||
? sl
|
||||
_byLang.TryGetValue(language, out SupportedLanguage? supportedLanguage)
|
||||
? supportedLanguage
|
||||
: throw new ArgumentOutOfRangeException(nameof(language), $"Unsupported: {language}");
|
||||
}
|
||||
3
JSMR.Domain/ValueObjects/VoiceWorkSeries.cs
Normal file
3
JSMR.Domain/ValueObjects/VoiceWorkSeries.cs
Normal file
@@ -0,0 +1,3 @@
|
||||
namespace JSMR.Domain.ValueObjects;
|
||||
|
||||
public sealed record VoiceWorkSeries(string Identifier, string Name);
|
||||
8
JSMR.Domain/ValueObjects/VoiceWorkTranslation.cs
Normal file
8
JSMR.Domain/ValueObjects/VoiceWorkTranslation.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using JSMR.Domain.Enums;
|
||||
|
||||
namespace JSMR.Domain.ValueObjects;
|
||||
|
||||
public sealed record VoiceWorkTranslation(
|
||||
string OriginalProductId,
|
||||
Language Language,
|
||||
TranslationKind Kind = TranslationKind.None);
|
||||
Reference in New Issue
Block a user