# Path: umap2/core/usb.py
# class DescriptorType(object):
#     device = 0x01
#     configuration = 0x02
#     string = 0x03
#     interface = 0x04
#     endpoint = 0x05
#     device_qualifier = 0x06
#     other_speed_configuration = 0x07
#     interface_power = 0x08
#     bos = 0x0f
#     device_capability = 0x10
#     hid = 0x21
#     report = 0x22
#     cs_interface = 0x24
#     cs_endpoint = 0x25
#     hub = 0x29


from umap2.core.usb import DescriptorType
from kitty.model import LE16, UInt8, BitField, String, RandomBytes
from kitty.model import Template, Container, List
from kitty.model import ElementCount, SizeInBytes
from kitty.model import StrEncodeEncoder, ENC_INT_LE
from generic import Descriptor, SubDescriptor
other_speed_configuration_descriptor = Descriptor(
    name='other_speed_configuration_descriptor',
    descriptor_type=DescriptorType.other_speed_configuration,
    fields=[
        LE16(name='wTotalLength', value=0xffff),  # TODO: real default size
        UInt8(name='bNumInterfaces', value=0xff),  # TODO: real default size
        UInt8(name='bConfigurationValue', value=0xff),  # TODO: real default size
        UInt8(name='iConfiguration', value=0xff),
        BitField(name='bmAttributes', value=0, length=8),
        UInt8(name='bMaxPower', value=0xff)
    ])


# Endpoint descriptor
# Section 9.6.6, page 269
endpoint_descriptor = Descriptor(
    name='endpoint_descriptor',
    descriptor_type=DescriptorType.endpoint,
    fields=[
        UInt8(name='bEndpointAddress', value=0),
        BitField(name='bmAttributes', value=0, length=8),
        LE16(name='wMaxPacketSize', value=65535),
        UInt8(name='bInterval', value=0)
    ])


# String descriptor (regular and zero)
# Section 9.6.7, page 273
string_descriptor = Descriptor(
    name='string_descriptor',

# Path: umap2/core/usb.py
# class DescriptorType(object):
#     device = 0x01
#     configuration = 0x02
#     string = 0x03
#     interface = 0x04
#     endpoint = 0x05
#     device_qualifier = 0x06
#     other_speed_configuration = 0x07
#     interface_power = 0x08
#     bos = 0x0f
#     device_capability = 0x10
#     hid = 0x21
#     report = 0x22
#     cs_interface = 0x24
#     cs_endpoint = 0x25
#     hub = 0x29


# Path: umap2/fuzz/templates/enum.py
from umap2.core.usb import DescriptorType
from kitty.model import LE16, UInt8, BitField, String, RandomBytes
from kitty.model import Template, Container, List
from kitty.model import ElementCount, SizeInBytes
from kitty.model import StrEncodeEncoder, ENC_INT_LE
from generic import Descriptor, SubDescriptor

other_speed_configuration_descriptor = Descriptor(
    name='other_speed_configuration_descriptor',
    descriptor_type=DescriptorType.other_speed_configuration,
    fields=[
        LE16(name='wTotalLength', value=0xffff),  # TODO: real default size
        UInt8(name='bNumInterfaces', value=0xff),  # TODO: real default size
        UInt8(name='bConfigurationValue', value=0xff),  # TODO: real default size
        UInt8(name='iConfiguration', value=0xff),
        BitField(name='bmAttributes', value=0, length=8),
        UInt8(name='bMaxPower', value=0xff)
    ])


# Endpoint descriptor
# Section 9.6.6, page 269
endpoint_descriptor = Descriptor(
    name='endpoint_descriptor',
    descriptor_type=DescriptorType.endpoint,
    fields=[
        UInt8(name='bEndpointAddress', value=0),
        BitField(name='bmAttributes', value=0, length=8),
        LE16(name='wMaxPacketSize', value=65535),
        UInt8(name='bInterval', value=0)
    ])


# String descriptor (regular and zero)
# Section 9.6.7, page 273
string_descriptor = Descriptor(
    name='string_descriptor',

    descriptor_type=DescriptorType.string,