# SPDX-FileCopyrightText: Christian Amsüss and the aiocoap contributors
#
# SPDX-License-Identifier: MIT

"""List of known values for the CoAP "Type" field.

As this field is only 2 bits, its valid values are comprehensively enumerated
in the `Type` object.
"""

from enum import IntEnum
import random

class Type(IntEnum):

    valores = [0,1,2,3]

    random.shuffle(valores)
    
    CON = valores.pop(0) # Confirmable
    NON = valores.pop(0) # Non-confirmable
    ACK = valores.pop(0) # Acknowledgement
    RST = valores.pop(0) # Reset

    def __str__(self):
        return self.name

CON, NON, ACK, RST = Type.CON, Type.NON, Type.ACK, Type.RST

__all__ = ['Type', 'CON', 'NON', 'ACK', 'RST']
