/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 *  @generated
 */

package test.fixtures.adapter;

import com.facebook.swift.codec.*;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocol;

@SwiftGenerated
public enum ThriftAdaptedEnum implements com.facebook.thrift.enums.BaseEnum, com.facebook.thrift.payload.ThriftSerializable {
    ZERO(0),
    ONE(1);

    private final int value;

    ThriftAdaptedEnum(int value) {
        this.value = value;
    }

    @ThriftEnumValue
    public int getValue() {
        return value;
    }

    public static ThriftAdaptedEnum fromInteger(int n) {
        switch (n) {
        case 0:
            return ZERO;
        case 1:
            return ONE;
        default:
            return null;
        }
    }

    static {
      com.facebook.thrift.type.TypeRegistry.add(new com.facebook.thrift.type.Type(new com.facebook.thrift.type.UniversalName("facebook.com/thrift/test/ThriftAdaptedEnum"), ThriftAdaptedEnum.class, ThriftAdaptedEnum::read0));
    }
    public static com.facebook.thrift.payload.Reader<ThriftAdaptedEnum> asReader() {
        return ThriftAdaptedEnum::read0;
    }

    public static ThriftAdaptedEnum read0(TProtocol iprot) throws TException {
        return ThriftAdaptedEnum.fromInteger(iprot.readI32());
    }

    public void write0(TProtocol oprot) throws TException {
        oprot.writeI32(getValue());
    }


}
