// <auto-generated>
//  automatically generated by the FlatBuffers compiler, do not modify
// </auto-generated>

using global::System;
using global::FlatBuffers;

namespace FlatBuffers.TRPAK
{
    public struct TRPAK : IFlatbufferObject
    {
        private Table __p;
        public ByteBuffer ByteBuffer { get { return __p.bb; } }
        public static TRPAK GetRootAsTRPAK(ByteBuffer _bb) { return GetRootAsTRPAK(_bb, new TRPAK()); }
        public static TRPAK GetRootAsTRPAK(ByteBuffer _bb, TRPAK obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
        public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
        public TRPAK __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

        public ulong Hashes(int j) { int o = __p.__offset(4); return o != 0 ? __p.bb.GetUlong(__p.__vector(o) + j * 8) : (ulong)0; }
        public int HashesLength { get { int o = __p.__offset(4); return o != 0 ? __p.__vector_len(o) : 0; } }
#if ENABLE_SPAN_T
  public Span<byte> GetHashesBytes() { return __p.__vector_as_span(4); }
#else
        public ArraySegment<byte>? GetHashesBytes() { return __p.__vector_as_arraysegment(4); }
#endif
        public ulong[] GetHashesArray() { return __p.__vector_as_array<ulong>(4); }
        public File? Files(int j) { int o = __p.__offset(6); return o != 0 ? (File?)(new File()).__assign(__p.__indirect(__p.__vector(o) + j * 4), __p.bb) : null; }
        public int FilesLength { get { int o = __p.__offset(6); return o != 0 ? __p.__vector_len(o) : 0; } }

        public static Offset<TRPAK> CreateTRPAK(FlatBufferBuilder builder,
            VectorOffset hashesOffset = default(VectorOffset),
            VectorOffset filesOffset = default(VectorOffset))
        {
            builder.StartObject(2);
            TRPAK.AddFiles(builder, filesOffset);
            TRPAK.AddHashes(builder, hashesOffset);
            return TRPAK.EndTRPAK(builder);
        }

        public static void StartTRPAK(FlatBufferBuilder builder) { builder.StartObject(2); }
        public static void AddHashes(FlatBufferBuilder builder, VectorOffset hashesOffset) { builder.AddOffset(0, hashesOffset.Value, 0); }
        public static VectorOffset CreateHashesVector(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); for (int i = data.Length - 1; i >= 0; i--) builder.AddUlong(data[i]); return builder.EndVector(); }
        public static VectorOffset CreateHashesVectorBlock(FlatBufferBuilder builder, ulong[] data) { builder.StartVector(8, data.Length, 8); builder.Add(data); return builder.EndVector(); }
        public static void StartHashesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(8, numElems, 8); }
        public static void AddFiles(FlatBufferBuilder builder, VectorOffset filesOffset) { builder.AddOffset(1, filesOffset.Value, 0); }
        public static VectorOffset CreateFilesVector(FlatBufferBuilder builder, Offset<File>[] data) { builder.StartVector(4, data.Length, 4); for (int i = data.Length - 1; i >= 0; i--) builder.AddOffset(data[i].Value); return builder.EndVector(); }
        public static VectorOffset CreateFilesVectorBlock(FlatBufferBuilder builder, Offset<File>[] data) { builder.StartVector(4, data.Length, 4); builder.Add(data); return builder.EndVector(); }
        public static void StartFilesVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(4, numElems, 4); }
        public static Offset<TRPAK> EndTRPAK(FlatBufferBuilder builder)
        {
            int o = builder.EndObject();
            return new Offset<TRPAK>(o);
        }
        public static void FinishTRPAKBuffer(FlatBufferBuilder builder, Offset<TRPAK> offset) { builder.Finish(offset.Value); }
        public static void FinishSizePrefixedTRPAKBuffer(FlatBufferBuilder builder, Offset<TRPAK> offset) { builder.FinishSizePrefixed(offset.Value); }
    };
    public struct File : IFlatbufferObject
    {
        private Table __p;
        public ByteBuffer ByteBuffer { get { return __p.bb; } }
        public static File GetRootAsFile(ByteBuffer _bb) { return GetRootAsFile(_bb, new File()); }
        public static File GetRootAsFile(ByteBuffer _bb, File obj) { return (obj.__assign(_bb.GetInt(_bb.Position) + _bb.Position, _bb)); }
        public void __init(int _i, ByteBuffer _bb) { __p.bb_pos = _i; __p.bb = _bb; }
        public File __assign(int _i, ByteBuffer _bb) { __init(_i, _bb); return this; }

        public byte Unused { get { int o = __p.__offset(4); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
        public Compression CompressionType { get { int o = __p.__offset(6); return o != 0 ? (Compression)__p.bb.Get(o + __p.bb_pos) : Compression.NONE; } }
        public byte Unk1 { get { int o = __p.__offset(8); return o != 0 ? __p.bb.Get(o + __p.bb_pos) : (byte)0; } }
        public ulong DecompressedSize { get { int o = __p.__offset(10); return o != 0 ? __p.bb.GetUlong(o + __p.bb_pos) : (ulong)0; } }
        public byte Data(int j) { int o = __p.__offset(12); return o != 0 ? __p.bb.Get(__p.__vector(o) + j * 1) : (byte)0; }
        public int DataLength { get { int o = __p.__offset(12); return o != 0 ? __p.__vector_len(o) : 0; } }
#if ENABLE_SPAN_T
  public Span<byte> GetDataBytes() { return __p.__vector_as_span(12); }
#else
        public ArraySegment<byte>? GetDataBytes() { return __p.__vector_as_arraysegment(12); }
#endif
        public byte[] GetDataArray() { return __p.__vector_as_array<byte>(12); }

        public static Offset<File> CreateFile(FlatBufferBuilder builder,
            byte unused = 0,
            Compression compression_type = Compression.NONE,
            byte unk1 = 0,
            ulong decompressed_size = 0,
            VectorOffset dataOffset = default(VectorOffset))
        {
            builder.StartObject(5);
            File.AddDecompressedSize(builder, decompressed_size);
            File.AddData(builder, dataOffset);
            File.AddUnk1(builder, unk1);
            File.AddCompressionType(builder, compression_type);
            File.AddUnused(builder, unused);
            return File.EndFile(builder);
        }

        public static void StartFile(FlatBufferBuilder builder) { builder.StartObject(5); }
        public static void AddUnused(FlatBufferBuilder builder, byte unused) { builder.AddByte(0, unused, 0); }
        public static void AddCompressionType(FlatBufferBuilder builder, Compression compressionType) { builder.AddByte(1, (byte)compressionType, 255); }
        public static void AddUnk1(FlatBufferBuilder builder, byte unk1) { builder.AddByte(2, unk1, 0); }
        public static void AddDecompressedSize(FlatBufferBuilder builder, ulong decompressedSize) { builder.AddUlong(3, decompressedSize, 0); }
        public static void AddData(FlatBufferBuilder builder, VectorOffset dataOffset) { builder.AddOffset(4, dataOffset.Value, 0); }
        public static VectorOffset CreateDataVector(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); for (int i = data.Length - 1; i >= 0; i--) builder.AddByte(data[i]); return builder.EndVector(); }
        public static VectorOffset CreateDataVectorBlock(FlatBufferBuilder builder, byte[] data) { builder.StartVector(1, data.Length, 1); builder.Add(data); return builder.EndVector(); }
        public static void StartDataVector(FlatBufferBuilder builder, int numElems) { builder.StartVector(1, numElems, 1); }
        public static Offset<File> EndFile(FlatBufferBuilder builder)
        {
            int o = builder.EndObject();
            return new Offset<File>(o);
        }
    };
    public enum Compression : byte
    {
        OODLE = 3,
        NONE = 255,
    };
}

