//using Modules.Library.Application.Gateways;
//using Modules.Library.Application.Models;

//namespace Modules.Library.Application.Services.MediaContent.CommonProperties;

//public class CommonPropertiesService(ILanguageGateway languageGateway, IGenreGateway genreGateway)
//{
//    internal async Task AddName(Domain.Entities.MediaContent.CommonProperties.CommonProperties commonProperties,
//        NameType nameType, Guid languageId, string value)
//    {
//        //if ((await languageGateway.GetLanguageById(languageId)) == null) throw new Exception("Language is not found");
//        var language = await languageGateway.GetLanguageById(languageId);
//        commonProperties.AddName((Domain.Entities.MediaContent.CommonProperties.NameType)nameType, language.Id, value);
//    }

//    public async Task SetNameValue(Domain.Entities.MediaContent.CommonProperties.CommonProperties commonProperties,
//        NameType nameType, Guid languageId, string name, string value) =>
//        commonProperties.SetNameValue(Domain.Entities.MediaContent.CommonProperties.NameItem.New(await ConvertNameItem(nameType, languageId, name)), value);

//    public async Task RemoveName(Domain.Entities.MediaContent.CommonProperties.CommonProperties commonProperties, NameType nameType, Guid languageId, string value) =>
//        commonProperties.RemoveName(Domain.Entities.MediaContent.CommonProperties.NameItem.New(await ConvertNameItem(nameType, languageId, value)));

//    /*
//    private void NewName() => NameItem.New(new Domain.Models.NameItem
//    {
//        Type = nameType,
//        Language = new Domain.Models.Language
//        {
//            Id = language.Id,
//            CodeIso2 = language.CodeIso2,
//            Name = language.Name,
//            IconId = language.IconId,
//            Deleted = language.Deleted,
//        },
//        Value = value,
//    }
//    */

//    private async Task<Domain.Models.NameItem> ConvertNameItem(NameType nameType, Guid languageId, string value)
//    {
//        var language = await languageGateway.GetLanguageById(languageId);
//        var result = new Domain.Models.NameItem
//        {
//            Type = (Domain.Entities.MediaContent.CommonProperties.NameType)nameType,
//            Language = ConvertLanguage(language),
//            Value = value,
//        };
//        return result;
//    }


//    private static Domain.Models.Language ConvertLanguage(Domain.Entities.Language.Language language) => new()
//    {
//        Id = language.Id,
//        CodeIso2 = language.CodeIso2,
//        Name = language.Name,
//        IconId = language.IconId,
//        Deleted = language.Deleted,
//    };

//    /*
//    public async Task AddPreview(Guid commonPropertiesId, string url, MediaInfoType type)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetPreview(url, type);
//    }
//    public async Task EditPreview(Guid commonPropertiesId, string url, MediaInfoType type) =>
//        await AddPreview(commonPropertiesId, url, type);
//    public async Task DeletePreview(Guid commonPropertiesId)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.DeletePreview();
//    }

//    public async Task AddDescription(Guid commonPropertiesId, string value, bool isOriginal = false)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        switch (isOriginal)
//        {
//            case true:
//                commonProperties.AddOriginalDescription(value);
//                break;
//            default:
//                commonProperties.AddNotOriginalDescription(value);
//                break;
//        }
//    }
//    public async Task SetDescriptionValue(Guid commonPropertiesId, Guid descriptionId, string value)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetDescriptionValue(descriptionId, value);
//    }
//    public async Task RemoveDescription(Guid commonPropertiesId, Guid descriptionId)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.RemoveDescription(descriptionId);
//    }

//    public async Task AddGenre(Guid commonPropertiesId, Guid genreId, decimal? value = null)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.AddGenre(genreId, value);
//    }
//    public async Task SetGenreProportion(Guid commonPropertiesId, Guid genreProportionItemId, decimal? value = null)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetGenreProportion(genreProportionItemId, value);
//    }
//    public async Task RemoveGenre(Guid commonPropertiesId, Guid genreId)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.RemoveGenre(genreId);
//    }

//    public async Task AddRelatedContent(Guid commonPropertiesId, string url, MediaInfoType type)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.AddRelatedContent(url, type);
//    }
//    public async Task EditRelatedContent(Guid commonPropertiesId, Guid relatedContentId, string url, MediaInfoType type)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.EditRelatedContent(relatedContentId, url, type);
//    }
//    public async Task RemoveRelatedContent(Guid commonPropertiesId, Guid relatedContentId)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.RemoveRelatedContent(relatedContentId);
//    }

//    public async Task SetAnnouncementDate(Guid commonPropertiesId, DateTimeOffset value)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetAnnouncementDate(value);
//    }
//    public async Task SetEstimatedReleaseDate(Guid commonPropertiesId, DateTimeOffset value)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetEstimatedReleaseDate(value);
//    }
//    public async Task SetReleaseDate(Guid commonPropertiesId, DateTimeOffset value)
//    {
//        var commonProperties = await GetCommonProperties(commonPropertiesId);
//        commonProperties.SetReleaseDate(value);
//    }

//    private async Task<Domain.Entities.MediaContent.CommonProperties.CommonProperties> GetCommonProperties(string commonPropertiesId)
//    {
//        return await commonPropertiesGateway.GetByMediaContentItemId(commonPropertiesId);
//    }
//    */
//}