using System.Text.Json.Serialization;

namespace ClaudeDo.Worker.Online;

// OwnerId carries the resource owner's Zitadel subject (sub). It is nullable and optional so
// the contract stays multi-user-ready without changing single-user behavior: today the desktop
// stamps it on push and defensively ignores pulled tasks owned by a different user, while the
// server remains the authority that scopes data by the token's sub.
public sealed record RemoteList(
    [property: JsonPropertyName("id")] string Id,
    [property: JsonPropertyName("name")] string Name,
    [property: JsonPropertyName("ownerId")] string? OwnerId = null);

public sealed record RemoteTask(
    [property: JsonPropertyName("id")] string Id,
    [property: JsonPropertyName("listId")] string ListId,
    [property: JsonPropertyName("title")] string Title,
    [property: JsonPropertyName("description")] string? Description,
    [property: JsonPropertyName("createdAt")] DateTimeOffset CreatedAt,
    [property: JsonPropertyName("ownerId")] string? OwnerId = null);

public sealed record MirrorTask(
    [property: JsonPropertyName("id")] string Id,
    [property: JsonPropertyName("listId")] string ListId,
    [property: JsonPropertyName("title")] string Title,
    [property: JsonPropertyName("description")] string? Description,
    [property: JsonPropertyName("ownerId")] string? OwnerId = null);
