using System.Text.Json; using Tiku.Application.Backoffice; using Tiku.Domain.Operations; namespace Tiku.Api.Contracts; public sealed class UpsertBackofficeRoleDto { public Guid? Id { get; set; } public string Code { get; set; } = string.Empty; public string Name { get; set; } = string.Empty; public BackendRoleStatus Status { get; set; } = BackendRoleStatus.Active; public string? Description { get; set; } public JsonElement? DataScope { get; set; } public UpsertBackofficeRoleCommand ToCommand() { return new UpsertBackofficeRoleCommand(Id, Code, Name, Status, Description, DataScope); } } public sealed class ReplaceRoleBindingsDto { public IReadOnlyCollection PermissionCodes { get; set; } = []; public IReadOnlyCollection MenuCodes { get; set; } = []; public ReplaceRoleBindingsCommand ToCommand(Guid roleId) { return new ReplaceRoleBindingsCommand(roleId, PermissionCodes, MenuCodes); } } public sealed class ReplaceUserRolesDto { public IReadOnlyCollection RoleIds { get; set; } = []; public ReplaceUserRolesCommand ToCommand(Guid userId) { return new ReplaceUserRolesCommand(userId, RoleIds); } }