// Autogenerated by Thrift Compiler (0.9.2)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package codec

import (
	"bytes"
	"context"
	"fmt"

	"github.com/apache/thrift/lib/go/thrift"
)

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

var GoUnusedProtection__ int

type ThriftEmpty struct {
}

func NewThriftEmpty() *ThriftEmpty {
	return &ThriftEmpty{}
}

func (p *ThriftEmpty) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(context.TODO()); err != nil {
		return fmt.Errorf("%T read error: %s", p, err)
	}
	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin(context.TODO())
		if err != nil {
			return fmt.Errorf("%T field %d read error: %s", p, fieldId, err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		if err := iprot.Skip(context.TODO(), fieldTypeId); err != nil {
			return err
		}
		if err := iprot.ReadFieldEnd(context.TODO()); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(context.TODO()); err != nil {
		return fmt.Errorf("%T read struct end error: %s", p, err)
	}
	return nil
}

func (p *ThriftEmpty) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin(context.TODO(), "ThriftEmpty"); err != nil {
		return fmt.Errorf("%T write struct begin error: %s", p, err)
	}
	if err := oprot.WriteFieldStop(context.TODO()); err != nil {
		return fmt.Errorf("write field stop error: %s", err)
	}
	if err := oprot.WriteStructEnd(context.TODO()); err != nil {
		return fmt.Errorf("write struct stop error: %s", err)
	}
	return nil
}

func (p *ThriftEmpty) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("ThriftEmpty(%+v)", *p)
}
