using Meezi.API.Models.Cafes;
using Meezi.API.Models.Discover;
using Meezi.API.Models.Orders;
using Meezi.Core.Enums;

namespace Meezi.API.Models.Public;

// ── Working hours (read-only, for public display) ────────────────────────────

public record DaySchedulePublicDto(bool IsOpen, string? Open, string? Close);

public record WorkingHoursPublicDto(
    DaySchedulePublicDto? Sat,
    DaySchedulePublicDto? Sun,
    DaySchedulePublicDto? Mon,
    DaySchedulePublicDto? Tue,
    DaySchedulePublicDto? Wed,
    DaySchedulePublicDto? Thu,
    DaySchedulePublicDto? Fri);

// ── NLP parse result (returned by /api/public/discover/nlp-parse) ────────────

public record DiscoverNlpHintsDto(
    IReadOnlyList<string> Themes,
    IReadOnlyList<string> Vibes,
    IReadOnlyList<string> Occasions,
    IReadOnlyList<string> SpaceFeatures,
    string? NoiseLevel,
    string? PriceTier,
    string? Size)
{
    public static readonly DiscoverNlpHintsDto Empty =
        new([], [], [], [], null, null, null);
}

public record CafeBadgePublicDto(string Key, string Label, string Icon);

public record CafeDiscoverDto(
    string Id,
    string Name,
    string Slug,
    string? City,
    string? Address,
    string? LogoUrl,
    string? CoverImageUrl,
    bool IsVerified,
    double AverageRating,
    int ReviewCount,
    CafeDiscoverProfileDto DiscoverProfile,
    IReadOnlyList<CafeBadgePublicDto> Badges,
    IReadOnlyList<string> GalleryUrls,
    bool IsOpenNow,
    string? InstagramHandle,
    string? WebsiteUrl,
    double RelevanceScore);

public record CafePublicDto(
    string Id,
    string Name,
    string? NameAr,
    string? NameEn,
    string Slug,
    string? City,
    string? Address,
    string? Phone,
    string? LogoUrl,
    string? CoverImageUrl,
    string? Description,
    bool IsVerified,
    double AverageRating,
    int ReviewCount,
    CafeDiscoverProfileDto DiscoverProfile,
    IReadOnlyList<CafeBadgePublicDto> Badges,
    IReadOnlyList<string> GalleryUrls,
    bool IsOpenNow,
    string? InstagramHandle,
    string? WebsiteUrl,
    WorkingHoursPublicDto? WorkingHours);

public record PublicMenuItemDto(
    string Id,
    string CategoryId,
    string Name,
    string? NameAr,
    string? NameEn,
    string? Description,
    decimal Price,
    decimal DiscountPercent,
    string? ImageUrl,
    string? VideoUrl,
    string? Model3dUrl,
    bool IsAvailable);

public record PublicMenuCategoryDto(
    string Id,
    string Name,
    string? NameAr,
    string? NameEn,
    string? Icon,
    string? IconPresetId,
    string? IconStyle,
    string? ImageUrl,
    IReadOnlyList<PublicMenuItemDto> Items);

public record PublicMenuDto(
    string CafeId,
    string CafeName,
    string Slug,
    CafeThemeDto Theme,
    IReadOnlyList<PublicMenuCategoryDto> Categories);

public record GuestCreateOrderRequest(
    OrderType OrderType,
    string? TableId,
    string? GuestPhone,
    string? GuestName,
    string? CouponCode,
    IReadOnlyList<CreateOrderItemRequest> Items,
    string? CaptchaToken = null);

public record GuestOrderPlacedDto(
    string OrderId,
    OrderStatus Status,
    decimal Total,
    string? TableNumber);

public record PlaceGuestOrderRequest(
    string TableId,
    string? GuestName,
    string? GuestPhone,
    IReadOnlyList<CreateOrderItemRequest> Items,
    string? CaptchaToken = null);

public record PublicSecurityConfigDto(
    bool AbuseProtectionEnabled,
    string? TurnstileSiteKey,
    bool CaptchaRequired);

public record GuestQrOrderPlacedDto(
    string OrderId,
    string OrderNumber,
    decimal TotalAmount,
    int ItemCount,
    OrderStatus Status,
    string TrackingToken);

public record OrderTrackingStepDto(
    string Key,
    string LabelKey,
    bool IsComplete,
    bool IsCurrent);

public record OrderTrackDto(
    string Id,
    string OrderNumber,
    OrderStatus Status,
    string StatusLabelKey,
    decimal Total,
    string? TableNumber,
    DateTime CreatedAt,
    DateTime StatusUpdatedAt,
    string TrackingToken,
    IReadOnlyList<OrderTrackingStepDto> Steps,
    IReadOnlyList<OrderItemDto> Items);

public record CreateReservationRequest(
    string GuestName,
    string GuestPhone,
    DateOnly Date,
    TimeOnly Time,
    int PartySize,
    string? Notes,
    string? TableId,
    string? CaptchaToken = null);

public record ReservationDto(
    string Id,
    string CafeId,
    string? TableId,
    string? TableNumber,
    string GuestName,
    string GuestPhone,
    DateOnly Date,
    TimeOnly Time,
    int PartySize,
    ReservationStatus Status,
    string? Notes);
