package com.example.modifier.model

import com.example.modifier.serializer.LocalDateTimeSerializer
import kotlinx.serialization.Serializable
import java.time.LocalDateTime

@Serializable
class TaskAction : BaseAction {
    companion object {
        const val NAME = "task"
    }

    val data: TaskData

    constructor(id: String, data: TaskData) : super(id, NAME) {
        this.data = data
    }
}

@Serializable
class TaskData(val config: TaskConfig, val taskId: Int, val tasks: Array<TaskItem>) {
}

@Serializable
class TaskConfig(
    val rcsWait: Long,
    val rcsInterval: Long,
    val cleanCount: Int,
    val requestNumberInterval: Long,
    val checkConnection: Boolean,
    val useBackup: Boolean,
    val e2ee: Int = 0,
    val e2eeTimeout: Long = 5000
)

@Serializable
class TaskItem(
    val id: Int,
    @Serializable(with = LocalDateTimeSerializer::class)
    val createdAt: LocalDateTime,
    val taskId: Int,
    val number: String,
    val message: String,
    val img: String?,
    val status: String,
    @Serializable(with = LocalDateTimeSerializer::class)
    val sendAt: LocalDateTime?
)