// automatically generated by the FlatBuffers compiler, do not modify
import * as flatbuffers from 'flatbuffers';
import { SecondTableInA } from '../namespace-a/second-table-in-a';
import { TableInFirstNS } from '../namespace-a/table-in-first-n-s';
export class TableInC {
    constructor() {
        this.bb = null;
        this.bb_pos = 0;
    }
    __init(i, bb) {
        this.bb_pos = i;
        this.bb = bb;
        return this;
    }
    static getRootAsTableInC(bb, obj) {
        return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    static getSizePrefixedRootAsTableInC(bb, obj) {
        bb.setPosition(bb.position() + flatbuffers.SIZE_PREFIX_LENGTH);
        return (obj || new TableInC()).__init(bb.readInt32(bb.position()) + bb.position(), bb);
    }
    referToA1(obj) {
        const offset = this.bb.__offset(this.bb_pos, 4);
        return offset ? (obj || new TableInFirstNS()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    referToA2(obj) {
        const offset = this.bb.__offset(this.bb_pos, 6);
        return offset ? (obj || new SecondTableInA()).__init(this.bb.__indirect(this.bb_pos + offset), this.bb) : null;
    }
    static getFullyQualifiedName() {
        return 'NamespaceC.TableInC';
    }
    static startTableInC(builder) {
        builder.startObject(2);
    }
    static addReferToA1(builder, referToA1Offset) {
        builder.addFieldOffset(0, referToA1Offset, 0);
    }
    static addReferToA2(builder, referToA2Offset) {
        builder.addFieldOffset(1, referToA2Offset, 0);
    }
    static endTableInC(builder) {
        const offset = builder.endObject();
        return offset;
    }
    unpack() {
        return new TableInCT((this.referToA1() !== null ? this.referToA1().unpack() : null), (this.referToA2() !== null ? this.referToA2().unpack() : null));
    }
    unpackTo(_o) {
        _o.referToA1 = (this.referToA1() !== null ? this.referToA1().unpack() : null);
        _o.referToA2 = (this.referToA2() !== null ? this.referToA2().unpack() : null);
    }
}
export class TableInCT {
    constructor(referToA1 = null, referToA2 = null) {
        this.referToA1 = referToA1;
        this.referToA2 = referToA2;
    }
    pack(builder) {
        const referToA1 = (this.referToA1 !== null ? this.referToA1.pack(builder) : 0);
        const referToA2 = (this.referToA2 !== null ? this.referToA2.pack(builder) : 0);
        TableInC.startTableInC(builder);
        TableInC.addReferToA1(builder, referToA1);
        TableInC.addReferToA2(builder, referToA2);
        return TableInC.endTableInC(builder);
    }
}
