// Autogenerated by Thrift for thrift/annotation/thrift.thrift
//
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
//  @generated

package thrift

import (
    "fmt"
    "reflect"

    thrift "github.com/facebook/fbthrift/thrift/lib/go/thrift/types"
)

// (needed to ensure safety because of naive import list construction)
var _ = fmt.Printf
var _ = reflect.Ptr
var _ = thrift.ZERO


type RpcPriority int32

const (
    RpcPriority_HIGH_IMPORTANT RpcPriority = 0
    RpcPriority_HIGH RpcPriority = 1
    RpcPriority_IMPORTANT RpcPriority = 2
    RpcPriority_NORMAL RpcPriority = 3
    RpcPriority_BEST_EFFORT RpcPriority = 4
)

// Enum value maps for RpcPriority
var (
    RpcPriorityToName = map[RpcPriority]string {
        RpcPriority_HIGH_IMPORTANT: "HIGH_IMPORTANT",
        RpcPriority_HIGH: "HIGH",
        RpcPriority_IMPORTANT: "IMPORTANT",
        RpcPriority_NORMAL: "NORMAL",
        RpcPriority_BEST_EFFORT: "BEST_EFFORT",
    }

    RpcPriorityToValue = map[string]RpcPriority {
        "HIGH_IMPORTANT": RpcPriority_HIGH_IMPORTANT,
        "HIGH": RpcPriority_HIGH,
        "IMPORTANT": RpcPriority_IMPORTANT,
        "NORMAL": RpcPriority_NORMAL,
        "BEST_EFFORT": RpcPriority_BEST_EFFORT,
    }
)

func (x RpcPriority) String() string {
    if v, ok := RpcPriorityToName[x]; ok {
        return v
    }
    return "<UNSET>"
}

func (x RpcPriority) Ptr() *RpcPriority {
    return &x
}

// Deprecated: Use RpcPriorityToValue instead (e.g. `x, ok := RpcPriorityToValue["name"]`).
func RpcPriorityFromString(s string) (RpcPriority, error) {
    if v, ok := RpcPriorityToValue[s]; ok {
        return v, nil
    }
    return RpcPriority(0), fmt.Errorf("not a valid RpcPriority string")
}

type Experimental struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*Experimental)(nil)

func NewExperimental() *Experimental {
    return (&Experimental{}).setDefaults()
}



func (x *Experimental) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Experimental"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Experimental) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Experimental) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Experimental) setDefaults() *Experimental {
    return x
}

type ReserveIds struct {
    Ids []int32 `thrift:"ids,1" json:"ids" db:"ids"`
    IdRanges map[int32]int32 `thrift:"id_ranges,2" json:"id_ranges" db:"id_ranges"`
}
// Compile time interface enforcer
var _ thrift.Struct = (*ReserveIds)(nil)

func NewReserveIds() *ReserveIds {
    return (&ReserveIds{}).setDefaults()
}

func (x *ReserveIds) GetIds() []int32 {
    if !x.IsSetIds() {
        return make([]int32, 0)
    }
    return x.Ids
}

func (x *ReserveIds) GetIdRanges() map[int32]int32 {
    if !x.IsSetIdRanges() {
        return make(map[int32]int32)
    }
    return x.IdRanges
}

func (x *ReserveIds) SetIdsNonCompat(value []int32) *ReserveIds {
    x.Ids = value
    return x
}

func (x *ReserveIds) SetIds(value []int32) *ReserveIds {
    x.Ids = value
    return x
}

func (x *ReserveIds) SetIdRangesNonCompat(value map[int32]int32) *ReserveIds {
    x.IdRanges = value
    return x
}

func (x *ReserveIds) SetIdRanges(value map[int32]int32) *ReserveIds {
    x.IdRanges = value
    return x
}

func (x *ReserveIds) IsSetIds() bool {
    return x != nil && x.Ids != nil
}

func (x *ReserveIds) IsSetIdRanges() bool {
    return x != nil && x.IdRanges != nil
}

func (x *ReserveIds) writeField1(p thrift.Encoder) error {  // Ids
    if err := p.WriteFieldBegin("ids", thrift.LIST, 1); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.Ids
    if err := p.WriteListBegin(thrift.I32, len(item)); err != nil {
        return thrift.PrependError("error writing list begin: ", err)
    }
    for _, v := range item {
        {
            item := v
            if err := p.WriteI32(item); err != nil {
                return err
            }
        }
    }
    if err := p.WriteListEnd(); err != nil {
        return thrift.PrependError("error writing list end: ", err)
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *ReserveIds) writeField2(p thrift.Encoder) error {  // IdRanges
    if err := p.WriteFieldBegin("id_ranges", thrift.MAP, 2); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.IdRanges
    if err := p.WriteMapBegin(thrift.I32, thrift.I32, len(item)); err != nil {
        return thrift.PrependError("error writing map begin: ", err)
    }
    for k, v := range item {
        {
            item := k
            if err := p.WriteI32(item); err != nil {
                return err
            }
        }
    
        {
            item := v
            if err := p.WriteI32(item); err != nil {
                return err
            }
        }
    }
    if err := p.WriteMapEnd(); err != nil {
        return thrift.PrependError("error writing map end: ", err)
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *ReserveIds) readField1(p thrift.Decoder) error {  // Ids
    _ /* elemType */, size, err := p.ReadListBegin()
    if err != nil {
        return thrift.PrependError("error reading list begin: ", err)
    }
    
    listResult := make([]int32, 0, size)
    for i := 0; i < size; i++ {
        var elem int32
        {
            result, err := p.ReadI32()
            if err != nil {
                return err
            }
            elem = result
        }
        listResult = append(listResult, elem)
    }
    
    if err := p.ReadListEnd(); err != nil {
        return thrift.PrependError("error reading list end: ", err)
    }
    result := listResult

    x.Ids = result
    return nil
}

func (x *ReserveIds) readField2(p thrift.Decoder) error {  // IdRanges
    _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin()
    if err != nil {
        return thrift.PrependError("error reading map begin: ", err)
    }
    
    mapResult := make(map[int32]int32, size)
    for i := 0; i < size; i++ {
        var key int32
        {
            result, err := p.ReadI32()
            if err != nil {
                return err
            }
            key = result
        }
    
        var value int32
        {
            result, err := p.ReadI32()
            if err != nil {
                return err
            }
            value = result
        }
    
        mapResult[key] = value
    }
    
    if err := p.ReadMapEnd(); err != nil {
        return thrift.PrependError("error reading map end: ", err)
    }
    result := mapResult

    x.IdRanges = result
    return nil
}



func (x *ReserveIds) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("ReserveIds"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }

    if err := x.writeField1(p); err != nil {
        return err
    }
    if err := x.writeField2(p); err != nil {
        return err
    }

    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *ReserveIds) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        case (id == 1 && wireType == thrift.Type(thrift.LIST)):  // ids
            fieldReadErr = x.readField1(p)
        case (id == 2 && wireType == thrift.Type(thrift.MAP)):  // id_ranges
            fieldReadErr = x.readField2(p)
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *ReserveIds) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *ReserveIds) setDefaults() *ReserveIds {
    return x.
        SetIdsNonCompat(make([]int32, 0)).
        SetIdRangesNonCompat(make(map[int32]int32))
}

type RequiresBackwardCompatibility struct {
    FieldName bool `thrift:"field_name,1" json:"field_name" db:"field_name"`
}
// Compile time interface enforcer
var _ thrift.Struct = (*RequiresBackwardCompatibility)(nil)

func NewRequiresBackwardCompatibility() *RequiresBackwardCompatibility {
    return (&RequiresBackwardCompatibility{}).setDefaults()
}

func (x *RequiresBackwardCompatibility) GetFieldName() bool {
    return x.FieldName
}

func (x *RequiresBackwardCompatibility) SetFieldNameNonCompat(value bool) *RequiresBackwardCompatibility {
    x.FieldName = value
    return x
}

func (x *RequiresBackwardCompatibility) SetFieldName(value bool) *RequiresBackwardCompatibility {
    x.FieldName = value
    return x
}

func (x *RequiresBackwardCompatibility) writeField1(p thrift.Encoder) error {  // FieldName
    if err := p.WriteFieldBegin("field_name", thrift.BOOL, 1); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.FieldName
    if err := p.WriteBool(item); err != nil {
        return err
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *RequiresBackwardCompatibility) readField1(p thrift.Decoder) error {  // FieldName
    result, err := p.ReadBool()
    if err != nil {
        return err
    }

    x.FieldName = result
    return nil
}



func (x *RequiresBackwardCompatibility) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("RequiresBackwardCompatibility"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }

    if err := x.writeField1(p); err != nil {
        return err
    }

    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *RequiresBackwardCompatibility) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        case (id == 1 && wireType == thrift.Type(thrift.BOOL)):  // field_name
            fieldReadErr = x.readField1(p)
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *RequiresBackwardCompatibility) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *RequiresBackwardCompatibility) setDefaults() *RequiresBackwardCompatibility {
    return x.
        SetFieldNameNonCompat(false)
}

type TerseWrite struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*TerseWrite)(nil)

func NewTerseWrite() *TerseWrite {
    return (&TerseWrite{}).setDefaults()
}



func (x *TerseWrite) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("TerseWrite"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *TerseWrite) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *TerseWrite) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *TerseWrite) setDefaults() *TerseWrite {
    return x
}

type Box struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*Box)(nil)

func NewBox() *Box {
    return (&Box{}).setDefaults()
}



func (x *Box) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Box"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Box) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Box) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Box) setDefaults() *Box {
    return x
}

type Mixin struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*Mixin)(nil)

func NewMixin() *Mixin {
    return (&Mixin{}).setDefaults()
}



func (x *Mixin) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Mixin"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Mixin) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Mixin) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Mixin) setDefaults() *Mixin {
    return x
}

type SerializeInFieldIdOrder struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*SerializeInFieldIdOrder)(nil)

func NewSerializeInFieldIdOrder() *SerializeInFieldIdOrder {
    return (&SerializeInFieldIdOrder{}).setDefaults()
}



func (x *SerializeInFieldIdOrder) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("SerializeInFieldIdOrder"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *SerializeInFieldIdOrder) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *SerializeInFieldIdOrder) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *SerializeInFieldIdOrder) setDefaults() *SerializeInFieldIdOrder {
    return x
}

type BitmaskEnum struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*BitmaskEnum)(nil)

func NewBitmaskEnum() *BitmaskEnum {
    return (&BitmaskEnum{}).setDefaults()
}



func (x *BitmaskEnum) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("BitmaskEnum"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *BitmaskEnum) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *BitmaskEnum) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *BitmaskEnum) setDefaults() *BitmaskEnum {
    return x
}

type ExceptionMessage struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*ExceptionMessage)(nil)

func NewExceptionMessage() *ExceptionMessage {
    return (&ExceptionMessage{}).setDefaults()
}



func (x *ExceptionMessage) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("ExceptionMessage"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *ExceptionMessage) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *ExceptionMessage) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *ExceptionMessage) setDefaults() *ExceptionMessage {
    return x
}

type InternBox struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*InternBox)(nil)

func NewInternBox() *InternBox {
    return (&InternBox{}).setDefaults()
}



func (x *InternBox) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("InternBox"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *InternBox) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *InternBox) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *InternBox) setDefaults() *InternBox {
    return x
}

type Serial struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*Serial)(nil)

func NewSerial() *Serial {
    return (&Serial{}).setDefaults()
}



func (x *Serial) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Serial"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Serial) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Serial) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Serial) setDefaults() *Serial {
    return x
}

type Uri struct {
    Value string `thrift:"value,1" json:"value" db:"value"`
}
// Compile time interface enforcer
var _ thrift.Struct = (*Uri)(nil)

func NewUri() *Uri {
    return (&Uri{}).setDefaults()
}

func (x *Uri) GetValue() string {
    return x.Value
}

func (x *Uri) SetValueNonCompat(value string) *Uri {
    x.Value = value
    return x
}

func (x *Uri) SetValue(value string) *Uri {
    x.Value = value
    return x
}

func (x *Uri) writeField1(p thrift.Encoder) error {  // Value
    if err := p.WriteFieldBegin("value", thrift.STRING, 1); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.Value
    if err := p.WriteString(item); err != nil {
        return err
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *Uri) readField1(p thrift.Decoder) error {  // Value
    result, err := p.ReadString()
    if err != nil {
        return err
    }

    x.Value = result
    return nil
}



func (x *Uri) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Uri"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }

    if err := x.writeField1(p); err != nil {
        return err
    }

    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Uri) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        case (id == 1 && wireType == thrift.Type(thrift.STRING)):  // value
            fieldReadErr = x.readField1(p)
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Uri) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Uri) setDefaults() *Uri {
    return x.
        SetValueNonCompat("")
}

type Priority struct {
    Level RpcPriority `thrift:"level,1" json:"level" db:"level"`
}
// Compile time interface enforcer
var _ thrift.Struct = (*Priority)(nil)

func NewPriority() *Priority {
    return (&Priority{}).setDefaults()
}

func (x *Priority) GetLevel() RpcPriority {
    return x.Level
}

func (x *Priority) SetLevelNonCompat(value RpcPriority) *Priority {
    x.Level = value
    return x
}

func (x *Priority) SetLevel(value RpcPriority) *Priority {
    x.Level = value
    return x
}

func (x *Priority) writeField1(p thrift.Encoder) error {  // Level
    if err := p.WriteFieldBegin("level", thrift.I32, 1); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.Level
    if err := p.WriteI32(int32(item)); err != nil {
        return err
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *Priority) readField1(p thrift.Decoder) error {  // Level
    enumResult, err := p.ReadI32()
    if err != nil {
        return err
    }
    result := RpcPriority(enumResult)

    x.Level = result
    return nil
}



func (x *Priority) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("Priority"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }

    if err := x.writeField1(p); err != nil {
        return err
    }

    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *Priority) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        case (id == 1 && wireType == thrift.Type(thrift.I32)):  // level
            fieldReadErr = x.readField1(p)
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *Priority) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *Priority) setDefaults() *Priority {
    return x.
        SetLevelNonCompat(0)
}

type DeprecatedUnvalidatedAnnotations struct {
    Items map[string]string `thrift:"items,1" json:"items" db:"items"`
}
// Compile time interface enforcer
var _ thrift.Struct = (*DeprecatedUnvalidatedAnnotations)(nil)

func NewDeprecatedUnvalidatedAnnotations() *DeprecatedUnvalidatedAnnotations {
    return (&DeprecatedUnvalidatedAnnotations{}).setDefaults()
}

func (x *DeprecatedUnvalidatedAnnotations) GetItems() map[string]string {
    if !x.IsSetItems() {
        return make(map[string]string)
    }
    return x.Items
}

func (x *DeprecatedUnvalidatedAnnotations) SetItemsNonCompat(value map[string]string) *DeprecatedUnvalidatedAnnotations {
    x.Items = value
    return x
}

func (x *DeprecatedUnvalidatedAnnotations) SetItems(value map[string]string) *DeprecatedUnvalidatedAnnotations {
    x.Items = value
    return x
}

func (x *DeprecatedUnvalidatedAnnotations) IsSetItems() bool {
    return x != nil && x.Items != nil
}

func (x *DeprecatedUnvalidatedAnnotations) writeField1(p thrift.Encoder) error {  // Items
    if err := p.WriteFieldBegin("items", thrift.MAP, 1); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field begin error: ", x), err)
    }

    item := x.Items
    if err := p.WriteMapBegin(thrift.STRING, thrift.STRING, len(item)); err != nil {
        return thrift.PrependError("error writing map begin: ", err)
    }
    for k, v := range item {
        {
            item := k
            if err := p.WriteString(item); err != nil {
                return err
            }
        }
    
        {
            item := v
            if err := p.WriteString(item); err != nil {
                return err
            }
        }
    }
    if err := p.WriteMapEnd(); err != nil {
        return thrift.PrependError("error writing map end: ", err)
    }

    if err := p.WriteFieldEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field end error: ", x), err)
    }
    return nil
}

func (x *DeprecatedUnvalidatedAnnotations) readField1(p thrift.Decoder) error {  // Items
    _ /* keyType */, _ /* valueType */, size, err := p.ReadMapBegin()
    if err != nil {
        return thrift.PrependError("error reading map begin: ", err)
    }
    
    mapResult := make(map[string]string, size)
    for i := 0; i < size; i++ {
        var key string
        {
            result, err := p.ReadString()
            if err != nil {
                return err
            }
            key = result
        }
    
        var value string
        {
            result, err := p.ReadString()
            if err != nil {
                return err
            }
            value = result
        }
    
        mapResult[key] = value
    }
    
    if err := p.ReadMapEnd(); err != nil {
        return thrift.PrependError("error reading map end: ", err)
    }
    result := mapResult

    x.Items = result
    return nil
}



func (x *DeprecatedUnvalidatedAnnotations) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("DeprecatedUnvalidatedAnnotations"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }

    if err := x.writeField1(p); err != nil {
        return err
    }

    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *DeprecatedUnvalidatedAnnotations) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        case (id == 1 && wireType == thrift.Type(thrift.MAP)):  // items
            fieldReadErr = x.readField1(p)
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *DeprecatedUnvalidatedAnnotations) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *DeprecatedUnvalidatedAnnotations) setDefaults() *DeprecatedUnvalidatedAnnotations {
    return x.
        SetItemsNonCompat(make(map[string]string))
}

type AllowReservedIdentifier struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*AllowReservedIdentifier)(nil)

func NewAllowReservedIdentifier() *AllowReservedIdentifier {
    return (&AllowReservedIdentifier{}).setDefaults()
}



func (x *AllowReservedIdentifier) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("AllowReservedIdentifier"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *AllowReservedIdentifier) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *AllowReservedIdentifier) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *AllowReservedIdentifier) setDefaults() *AllowReservedIdentifier {
    return x
}

type AllowReservedFilename struct {
}
// Compile time interface enforcer
var _ thrift.Struct = (*AllowReservedFilename)(nil)

func NewAllowReservedFilename() *AllowReservedFilename {
    return (&AllowReservedFilename{}).setDefaults()
}



func (x *AllowReservedFilename) Write(p thrift.Encoder) error {
    if err := p.WriteStructBegin("AllowReservedFilename"); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", x), err)
    }


    if err := p.WriteFieldStop(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write field stop error: ", x), err)
    }

    if err := p.WriteStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T write struct end error: ", x), err)
    }
    return nil
}

func (x *AllowReservedFilename) Read(p thrift.Decoder) error {
    if _, err := p.ReadStructBegin(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read error: ", x), err)
    }

    for {
        _, wireType, id, err := p.ReadFieldBegin()
        if err != nil {
            return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", x, id), err)
        }

        if wireType == thrift.STOP {
            break;
        }

        var fieldReadErr error
        switch {
        default:
            fieldReadErr = p.Skip(wireType)
        }

        if fieldReadErr != nil {
            return fieldReadErr
        }

        if err := p.ReadFieldEnd(); err != nil {
            return err
        }
    }

    if err := p.ReadStructEnd(); err != nil {
        return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", x), err)
    }

    return nil
}

func (x *AllowReservedFilename) String() string {
    return thrift.StructToString(reflect.ValueOf(x))
}

func (x *AllowReservedFilename) setDefaults() *AllowReservedFilename {
    return x
}



// RegisterTypes registers types found in this file that have a thrift_uri with the passed in registry.
func RegisterTypes(registry interface {
  RegisterType(name string, initializer func() any)
}) {
    registry.RegisterType("facebook.com/thrift/annotation/Experimental", func() any { return NewExperimental() })
    registry.RegisterType("facebook.com/thrift/annotation/ReserveIds", func() any { return NewReserveIds() })
    registry.RegisterType("facebook.com/thrift/annotation/RequiresBackwardCompatibility", func() any { return NewRequiresBackwardCompatibility() })
    registry.RegisterType("facebook.com/thrift/annotation/TerseWrite", func() any { return NewTerseWrite() })
    registry.RegisterType("facebook.com/thrift/annotation/Box", func() any { return NewBox() })
    registry.RegisterType("facebook.com/thrift/annotation/Mixin", func() any { return NewMixin() })
    registry.RegisterType("facebook.com/thrift/annotation/SerializeInFieldIdOrder", func() any { return NewSerializeInFieldIdOrder() })
    registry.RegisterType("facebook.com/thrift/annotation/BitmaskEnum", func() any { return NewBitmaskEnum() })
    registry.RegisterType("facebook.com/thrift/annotation/ExceptionMessage", func() any { return NewExceptionMessage() })
    registry.RegisterType("facebook.com/thrift/annotation/InternBox", func() any { return NewInternBox() })
    registry.RegisterType("facebook.com/thrift/annotation/Serial", func() any { return NewSerial() })
    registry.RegisterType("facebook.com/thrift/annotation/Uri", func() any { return NewUri() })
    registry.RegisterType("facebook.com/thrift/annotation/Priority", func() any { return NewPriority() })
    registry.RegisterType("facebook.com/thrift/annotation/DeprecatedUnvalidatedAnnotations", func() any { return NewDeprecatedUnvalidatedAnnotations() })
    registry.RegisterType("facebook.com/thrift/annotation/AllowReservedIdentifier", func() any { return NewAllowReservedIdentifier() })
    registry.RegisterType("facebook.com/thrift/annotation/AllowReservedFilename", func() any { return NewAllowReservedFilename() })

    registry.RegisterType("facebook.com/thrift/annotation/RpcPriority", func() any { return RpcPriority(0) })
}
