/* tslint:disable */
/* eslint-disable */
/*
 * Autogenerated by @creditkarma/thrift-typescript v3.7.2
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
import * as thrift from "thrift";
import * as Encoding from "./Encoding";
import * as PageType from "./PageType";
export interface IPageEncodingStatsArgs {
  page_type: PageType.PageType;
  encoding: Encoding.Encoding;
  count: number;
}
export class PageEncodingStats {
  public page_type: PageType.PageType;
  public encoding: Encoding.Encoding;
  public count: number;
  constructor(args: IPageEncodingStatsArgs) {
    if (args != null && args.page_type != null) {
      this.page_type = args.page_type;
    }
    else {
      throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[page_type] is unset!");
    }
    if (args != null && args.encoding != null) {
      this.encoding = args.encoding;
    }
    else {
      throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[encoding] is unset!");
    }
    if (args != null && args.count != null) {
      this.count = args.count;
    }
    else {
      throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Required field[count] is unset!");
    }
  }
  public write(output: thrift.TProtocol): void {
    output.writeStructBegin("PageEncodingStats");
    if (this.page_type != null) {
      output.writeFieldBegin("page_type", thrift.Thrift.Type.I32, 1);
      output.writeI32(this.page_type);
      output.writeFieldEnd();
    }
    if (this.encoding != null) {
      output.writeFieldBegin("encoding", thrift.Thrift.Type.I32, 2);
      output.writeI32(this.encoding);
      output.writeFieldEnd();
    }
    if (this.count != null) {
      output.writeFieldBegin("count", thrift.Thrift.Type.I32, 3);
      output.writeI32(this.count);
      output.writeFieldEnd();
    }
    output.writeFieldStop();
    output.writeStructEnd();
    return;
  }
  public static read(input: thrift.TProtocol): PageEncodingStats {
    input.readStructBegin();
    let _args: any = {};
    while (true) {
      const ret: thrift.TField = input.readFieldBegin();
      const fieldType: thrift.Thrift.Type = ret.ftype;
      const fieldId: number = ret.fid;
      if (fieldType === thrift.Thrift.Type.STOP) {
        break;
      }
      switch (fieldId) {
        case 1:
          if (fieldType === thrift.Thrift.Type.I32) {
            const value_1: PageType.PageType = input.readI32();
            _args.page_type = value_1;
          }
          else {
            input.skip(fieldType);
          }
          break;
        case 2:
          if (fieldType === thrift.Thrift.Type.I32) {
            const value_2: Encoding.Encoding = input.readI32();
            _args.encoding = value_2;
          }
          else {
            input.skip(fieldType);
          }
          break;
        case 3:
          if (fieldType === thrift.Thrift.Type.I32) {
            const value_3: number = input.readI32();
            _args.count = value_3;
          }
          else {
            input.skip(fieldType);
          }
          break;
        default: {
          input.skip(fieldType);
        }
      }
      input.readFieldEnd();
    }
    input.readStructEnd();
    if (_args.page_type !== undefined && _args.encoding !== undefined && _args.count !== undefined) {
      return new PageEncodingStats(_args);
    }
    else {
      throw new thrift.Thrift.TProtocolException(thrift.Thrift.TProtocolExceptionType.UNKNOWN, "Unable to read PageEncodingStats from input");
    }
  }
}
