package com.isidroid.job.constant

import androidx.annotation.IntDef

@Retention(AnnotationRetention.SOURCE)
@IntDef
annotation class JobStatus {
    companion object {
        const val CREATED = 1
        const val CANCELED = 2
        const val READY = 3
        const val ACCEPTED = 4
        const val REJECTED = 5
        const val PRINTING = 6
        const val COMPLETED = 7
        const val ERROR = 8

        const val IDLE = 0
        const val RENDER_UPLOAD = 9
        const val READY_TO_PRINT = 10
        const val UPLOAD_ERROR = 11
    }
}

@JobStatus
val Int.statusName
    get() = when (this) {
        JobStatus.CREATED -> "CREATED"
        JobStatus.CANCELED -> "CANCELED"
        JobStatus.READY -> "READY"
        JobStatus.ACCEPTED -> "ACCEPTED"
        JobStatus.REJECTED -> "REJECTED"
        JobStatus.PRINTING -> "PRINTING"
        JobStatus.COMPLETED -> "COMPLETED"
        JobStatus.ERROR -> "ERROR"

        JobStatus.IDLE -> "IDLE"
        JobStatus.RENDER_UPLOAD -> "RENDER_UPLOAD"
        JobStatus.READY_TO_PRINT -> "READY_TO_PRINT"
        JobStatus.UPLOAD_ERROR -> "UPLOAD_ERROR"
        else -> "Unknown"
    }