using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using Sony.Filtr.Contracts.Entities; namespace Sony.Filtr.API.ViewModels.v3 { [DataContract] public class MarketViewModel { public MarketViewModel() { Services = new List(); } [DataMember(Name = "name", Order = 1)] public string Name { get; set; } [DataMember(Name = "id", Order = 2)] public int ID { get; set; } [DataMember(Name = "locale", Order = 3)] public string Locale { get; set; } [DataMember(Name = "defaultService", Order = 4)] public string DefaultService { get; set; } [DataMember(Name = "services", Order = 5)] public List Services { get; set; } [DataMember(Name = "isFallback", Order = 6)] public bool IsFallback { get; set; } public static MarketViewModel CreateMarketViewModel(Application application) { return new MarketViewModel() { Name = application.Name, ID = application.ID, IsFallback = application.FallbackApplication, DefaultService = application.DefaultService, Locale = application.CultureInfo.Name, Services = application.Services ?? new List() }; } } }