package com.tt.honeyDue.models

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class DeviceRegistrationRequest(
    @SerialName("device_id")
    val deviceId: String,
    @SerialName("registration_id")
    val registrationId: String,
    val platform: String, // "android" or "ios"
    val name: String? = null
)

@Serializable
data class DeviceRegistrationResponse(
    val id: Int,
    val name: String? = null,
    @SerialName("device_id")
    val deviceId: String,
    @SerialName("registration_id")
    val registrationId: String,
    val platform: String,
    val active: Boolean,
    @SerialName("date_created")
    val dateCreated: String
)

@Serializable
data class NotificationPreference(
    @SerialName("task_due_soon")
    val taskDueSoon: Boolean = true,
    @SerialName("task_overdue")
    val taskOverdue: Boolean = true,
    @SerialName("task_completed")
    val taskCompleted: Boolean = true,
    @SerialName("task_assigned")
    val taskAssigned: Boolean = true,
    @SerialName("residence_shared")
    val residenceShared: Boolean = true,
    @SerialName("warranty_expiring")
    val warrantyExpiring: Boolean = true,
    @SerialName("daily_digest")
    val dailyDigest: Boolean = true,
    // Email preferences
    @SerialName("email_task_completed")
    val emailTaskCompleted: Boolean = true,
    // Custom notification times (UTC hour 0-23, null means use system default)
    @SerialName("task_due_soon_hour")
    val taskDueSoonHour: Int? = null,
    @SerialName("task_overdue_hour")
    val taskOverdueHour: Int? = null,
    @SerialName("warranty_expiring_hour")
    val warrantyExpiringHour: Int? = null,
    @SerialName("daily_digest_hour")
    val dailyDigestHour: Int? = null
)

@Serializable
data class UpdateNotificationPreferencesRequest(
    @SerialName("task_due_soon")
    val taskDueSoon: Boolean? = null,
    @SerialName("task_overdue")
    val taskOverdue: Boolean? = null,
    @SerialName("task_completed")
    val taskCompleted: Boolean? = null,
    @SerialName("task_assigned")
    val taskAssigned: Boolean? = null,
    @SerialName("residence_shared")
    val residenceShared: Boolean? = null,
    @SerialName("warranty_expiring")
    val warrantyExpiring: Boolean? = null,
    @SerialName("daily_digest")
    val dailyDigest: Boolean? = null,
    // Email preferences
    @SerialName("email_task_completed")
    val emailTaskCompleted: Boolean? = null,
    // Custom notification times (UTC hour 0-23)
    @SerialName("task_due_soon_hour")
    val taskDueSoonHour: Int? = null,
    @SerialName("task_overdue_hour")
    val taskOverdueHour: Int? = null,
    @SerialName("warranty_expiring_hour")
    val warrantyExpiringHour: Int? = null,
    @SerialName("daily_digest_hour")
    val dailyDigestHour: Int? = null
)

@Serializable
data class Notification(
    val id: Int,
    @SerialName("notification_type")
    val notificationType: String,
    val title: String,
    val body: String,
    val data: Map<String, String> = emptyMap(),
    val sent: Boolean,
    @SerialName("sent_at")
    val sentAt: String? = null,
    val read: Boolean,
    @SerialName("read_at")
    val readAt: String? = null,
    @SerialName("created_at")
    val createdAt: String,
    @SerialName("task_id")
    val taskId: Int? = null
)

@Serializable
data class NotificationListResponse(
    val count: Int,
    val results: List<Notification>
)

@Serializable
data class UnreadCountResponse(
    @SerialName("unread_count")
    val unreadCount: Int
)
