using System.ComponentModel.DataAnnotations;
using Bit.Api.Auth.Models.Public.Response;
using Bit.Core.Entities;
using Bit.Core.Models.Data;
namespace Bit.Api.Models.Public.Response;
///
/// A user group.
///
public class GroupResponseModel : GroupBaseModel, IResponseModel
{
public GroupResponseModel(Group group, IEnumerable collections)
{
if (group == null)
{
throw new ArgumentNullException(nameof(group));
}
Id = group.Id;
Name = group.Name;
AccessAll = group.AccessAll;
ExternalId = group.ExternalId;
Collections = collections?.Select(c => new AssociationWithPermissionsResponseModel(c));
}
///
/// String representing the object's type. Objects of the same type share the same properties.
///
/// group
[Required]
public string Object => "group";
///
/// The group's unique identifier.
///
/// 539a36c5-e0d2-4cf9-979e-51ecf5cf6593
[Required]
public Guid Id { get; set; }
///
/// The associated collections that this group can access.
///
public IEnumerable Collections { get; set; }
}