66 lines
2.2 KiB
C#
66 lines
2.2 KiB
C#
using ManagerService.DTOs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace ManagerService.Data
|
|
{
|
|
/// <summary>
|
|
/// Represents the association between an application instance (e.g., mobile or tablet app)
|
|
/// and a specific configuration. This link defines which configurations are used by which
|
|
/// application instances, optionally with an order or active status.
|
|
/// Useful for managing configuration assignment and display logic per app type.
|
|
/// </summary>
|
|
public class AppConfigurationLink
|
|
{
|
|
[Key]
|
|
public string Id { get; set; }
|
|
|
|
[Required]
|
|
public string ConfigurationId { get; set; }
|
|
|
|
[Required]
|
|
public string ApplicationInstanceId { get; set; }
|
|
|
|
public int? Order { get; set; }
|
|
|
|
public bool IsActive { get; set; } = true;
|
|
|
|
public int? WeightMasonryGrid { get; set; }
|
|
|
|
[ForeignKey(nameof(ConfigurationId))]
|
|
public Configuration Configuration { get; set; }
|
|
|
|
[ForeignKey(nameof(ApplicationInstanceId))]
|
|
public ApplicationInstance ApplicationInstance { get; set; }
|
|
|
|
public AppConfigurationLinkDTO ToDTO()
|
|
{
|
|
return new AppConfigurationLinkDTO()
|
|
{
|
|
Id = Id,
|
|
ConfigurationId = ConfigurationId,
|
|
ApplicationInstanceId = ApplicationInstanceId,
|
|
Order = Order,
|
|
IsActive = IsActive,
|
|
WeightMasonryGrid = WeightMasonryGrid
|
|
};
|
|
}
|
|
|
|
public AppConfigurationLink FromDTO(AppConfigurationLinkDTO appConfigurationLinkDTO)
|
|
{
|
|
return new AppConfigurationLink()
|
|
{
|
|
Id = appConfigurationLinkDTO.Id,
|
|
ConfigurationId = appConfigurationLinkDTO.ConfigurationId,
|
|
ApplicationInstanceId = appConfigurationLinkDTO.ApplicationInstanceId,
|
|
Order = appConfigurationLinkDTO.Order,
|
|
IsActive = appConfigurationLinkDTO.IsActive,
|
|
WeightMasonryGrid = appConfigurationLinkDTO?.WeightMasonryGrid,
|
|
};
|
|
}
|
|
|
|
}
|
|
}
|