namespace ClawdDotNet.Web.Contracts;
/// #683: The organisation of an instance — units, members, and what is wrong with it.
public sealed record OrganisationDto(
IReadOnlyList Units,
IReadOnlyList Agents,
IReadOnlyList Problems,
IReadOnlyList KnownTools,
IReadOnlyList Workspaces);
public sealed record UnitDto(
string Id,
string Name,
string? ParentId,
string? LeaderAgentId,
string Goal,
IReadOnlyList? ToolCeiling,
IReadOnlyList? EffectiveToolCeiling,
UnitDefaultsDto Defaults,
string Path,
int Depth);
public sealed record UnitDefaultsDto(string? Model, decimal? DailyCostUsd, long? DailyTokens, string? WhenExhausted);
/// An agent as the organisation page shows it: where it is, whom it answers to.
public sealed record OrgMemberDto(
string AgentId,
string DisplayName,
string? UnitId,
bool IsLead,
string? EffectiveLeadId,
DateTime? UnitSinceUtc,
IReadOnlyList Tools,
decimal DailyCostUsd,
long DailyTokens,
string Model);
public sealed record UnitInputDto(string Id, string Name, string? ParentId = null, string? Goal = null, string Reason = "");
public sealed record UnitUpdateDto(string? Name = null, string? Goal = null, string Reason = "");
public sealed record LeaderInputDto(string? AgentId, string Reason = "");
///
/// A move or a ceiling change. With nothing is written — the answer
/// says what would happen. confirms removing the tools beyond a
/// ceiling that the preview named.
///
public sealed record MoveInputDto(string? Target, string Reason = "", bool DropExcessTools = false, bool Preview = false);
public sealed record CeilingInputDto(IReadOnlyList? Tools, string Reason = "", bool DropExcessTools = false, bool Preview = false);
public sealed record StructurePreviewDto(
IReadOnlyList AffectedAgents,
IReadOnlyDictionary> ToolsLost,
IReadOnlyList Running,
IReadOnlyList Problems,
bool CanApply);
public sealed record SettingPreviewInputDto(string Setting, string Value, string Mode = "PerAgent");
public sealed record SettingChangeDto(string AgentId, string DisplayName, string Current, string Proposed, bool Outlier, bool SelectedByDefault);
public sealed record SettingApplyDto(string Setting, IReadOnlyDictionary Values, string Reason = "", string? DefaultValue = null);
///
/// #684: A workspace with its member list — and, computed by the instance, who that list
/// actually lets in and how far. marks a unit's own workspace.
///
public sealed record WorkspaceDto(
string Id,
string Name,
string Purpose,
string? OwnerUnitId,
bool IsUnitOwn,
IReadOnlyList Members,
IReadOnlyList ProtectedPaths,
int FileCount,
IReadOnlyList Access);
/// A member entry: a unit or an agent; is Read, Write or Manage.
public sealed record WorkspaceMemberDto(string? UnitId, string? AgentId, string Access, bool IncludeSubUnits = true);
public sealed record WorkspaceAccessDto(string AgentId, string Access);
public sealed record WorkspaceInputDto(
string Id,
string Name,
string? Purpose = null,
string? OwnerUnitId = null,
IReadOnlyList? Members = null,
string Reason = "");
public sealed record WorkspaceUpdateDto(string? Name = null, string? Purpose = null, IReadOnlyList? ProtectedPaths = null, string Reason = "");
public sealed record WorkspaceMembersInputDto(IReadOnlyList Members, string Reason = "");
/// A change that needs nothing but the reason for the audit log.
public sealed record ReasonInputDto(string Reason = "");