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

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

// 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 2023-03-07
@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

/**
 * "resource-state" enum as defined in:
 * [PWG5100.22](https://ftp.pwg.org/pub/pwg/candidates/cs-ippsystem10-20191122-5100.22.pdf).
 */
data class ResourceState(override val code: Int, override val name: String) : Enum() {

    override fun toString() = super.toString()

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

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

    object Code {
        const val pending = 3
        const val available = 4
        const val installed = 5
        const val canceled = 6
        const val aborted = 7
    }

    companion object {
        @JvmField val pending = ResourceState(Code.pending, "pending")
        @JvmField val available = ResourceState(Code.available, "available")
        @JvmField val installed = ResourceState(Code.installed, "installed")
        @JvmField val canceled = ResourceState(Code.canceled, "canceled")
        @JvmField val aborted = ResourceState(Code.aborted, "aborted")

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy