# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild

import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO


if getattr(kaitaistruct, 'API_VERSION', (0, 9)) < (0, 9):
    raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (kaitaistruct.__version__))

class ColumnDataIdf(KaitaiStruct):
    def __init__(self, _io, _parent=None, _root=None):
        self._io = _io
        self._parent = _parent
        self._root = _root if _root else self
        self._read()

    def _read(self):
        self.segments = []
        i = 0
        while not self._io.is_eof():
            self.segments.append(ColumnDataIdf.Segment(self._io, self, self._root))
            i += 1


    class Segment(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.primary_segment_size = self._io.read_u8le()
            self.primary_segment = []
            for i in range(self.primary_segment_size):
                self.primary_segment.append(ColumnDataIdf.SegmentEntry(self._io, self, self._root))

            self.sub_segment_size = self._io.read_u8le()
            self.sub_segment = []
            for i in range(self.sub_segment_size):
                self.sub_segment.append(self._io.read_u8le())



    class SegmentEntry(KaitaiStruct):
        def __init__(self, _io, _parent=None, _root=None):
            self._io = _io
            self._parent = _parent
            self._root = _root if _root else self
            self._read()

        def _read(self):
            self.data_value = self._io.read_u4le()
            self.repeat_value = self._io.read_u4le()

