using System.ComponentModel.DataAnnotations; using Bit.Core.Entities; using Bit.Core.Models.Data; namespace Bit.Api.Models.Public.Response; /// /// A collection. /// public class CollectionResponseModel : CollectionBaseModel, IResponseModel { public CollectionResponseModel(Collection collection, IEnumerable groups) { if (collection == null) { throw new ArgumentNullException(nameof(collection)); } Id = collection.Id; ExternalId = collection.ExternalId; Groups = groups?.Select(c => new AssociationWithPermissionsResponseModel(c)); } /// /// String representing the object's type. Objects of the same type share the same properties. /// /// collection [Required] public string Object => "collection"; /// /// The collection's unique identifier. /// /// 539a36c5-e0d2-4cf9-979e-51ecf5cf6593 [Required] public Guid Id { get; set; } /// /// The associated groups that this collection is assigned to. /// public IEnumerable Groups { get; set; } }