All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hp.jipp.model.DocumentState.kt Maven / Gradle / Ivy

There is a newer version: 0.7.16
Show newest version
// Copyright 2018 HP Development Company, L.P.
// SPDX-License-Identifier: MIT
//
// DO NOT MODIFY. Code is auto-generated by genTypes.py. Content taken from registry at
// https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xml, updated on 2021-05-04
@file:Suppress("MaxLineLength", "WildcardImport")

package com.hp.jipp.model

import com.hp.jipp.encoding.* // ktlint-disable
import com.hp.jipp.encoding.Enum // Override java Enum

/**
 * "document-state" enum as defined in:
 * [PWG5100.18](https://ftp.pwg.org/pub/pwg/candidates/cs-ippinfra10-20150619-5100.18.pdf),
 * [PWG5100.5](https://ftp.pwg.org/pub/pwg/candidates/cs-ippdocobject11-20190521-5100.5.pdf).
 */
data class DocumentState(override val code: Int, override val name: String) : Enum() {

    override fun toString() = super.toString()

    /** An [AttributeType] for a [DocumentState] attribute. */
    class Type(name: String) : EnumType(name, { get(it) })

    /** An [AttributeType] for multiple [DocumentState] attributes. */
    class SetType(name: String) : EnumType.Set(name, { get(it) })

    object Code {
        const val pending = 3
        const val processing = 5
        const val processingStopped = 6
        const val canceled = 7
        const val aborted = 8
        const val completed = 9
    }

    companion object {
        @JvmField val pending = DocumentState(Code.pending, "pending")
        @JvmField val processing = DocumentState(Code.processing, "processing")
        @JvmField val processingStopped = DocumentState(Code.processingStopped, "processing-stopped")
        @JvmField val canceled = DocumentState(Code.canceled, "canceled")
        @JvmField val aborted = DocumentState(Code.aborted, "aborted")
        @JvmField val completed = DocumentState(Code.completed, "completed")

        @JvmField val all = listOf(
            pending,
            processing,
            processingStopped,
            canceled,
            aborted,
            completed,
        ).map { it.code to it }.toMap()

        operator fun get(value: Int): DocumentState =
            all[value] ?: DocumentState(value, "???")
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy