63 lines
2.1 KiB
C#
63 lines
2.1 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)
|
|
{
|
|
ConfigurationId = appConfigurationLinkDTO.configurationId;
|
|
ApplicationInstanceId = appConfigurationLinkDTO.applicationInstanceId;
|
|
Order = appConfigurationLinkDTO.order;
|
|
IsActive = appConfigurationLinkDTO.isActive;
|
|
WeightMasonryGrid = appConfigurationLinkDTO?.weightMasonryGrid;
|
|
return this;
|
|
}
|
|
|
|
}
|
|
}
|