using System.Text.Json.Serialization;

namespace MemberCenter.Api.Contracts;

public sealed record SubscribeRequest(
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("email")] string Email,
    [property: JsonPropertyName("preferences")] Dictionary<string, object>? Preferences,
    [property: JsonPropertyName("source")] string? Source);

public sealed record UnsubscribeRequest(
    [property: JsonPropertyName("token")] string Token);

public sealed record IssueUnsubscribeTokenRequest(
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("email")] string Email);

public sealed record IssueOneClickUnsubscribeTokenRequest(
    [property: JsonPropertyName("tenant_id")] Guid TenantId,
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("subscriber_id")] Guid SubscriberId);

public sealed record IssueOneClickUnsubscribeTokensRequest(
    [property: JsonPropertyName("tenant_id")] Guid TenantId,
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("subscriber_ids")] List<Guid> SubscriberIds);

public sealed record UpdatePreferencesRequest(
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("email")] string Email,
    [property: JsonPropertyName("preferences")] Dictionary<string, object> Preferences);

public sealed record DisableSubscriptionRequest(
    [property: JsonPropertyName("tenant_id")] Guid TenantId,
    [property: JsonPropertyName("subscriber_id")] Guid SubscriberId,
    [property: JsonPropertyName("list_id")] Guid ListId,
    [property: JsonPropertyName("reason")] string Reason,
    [property: JsonPropertyName("disabled_by")] string DisabledBy,
    [property: JsonPropertyName("occurred_at")] DateTimeOffset OccurredAt);
