package protocol

import (
	"bytes"
	"context"
	"fmt"
	"git.apache.org/thrift.git/lib/go/thrift"
	"time"
)

var _ = thrift.ZERO
var _ = fmt.Printf
var _ = bytes.Equal

type IWfs interface {

	WfsPost(wf *WfsFile) (r *WfsAck, err error)

	WfsRead(name string) (r *WfsFile, err error)

	WfsDel(name string) (r *WfsAck, err error)

	WfsCmd(wc *WfsCmd) (r *WfsAck, err error)
}

type IWfsClient struct {
	Transport       thrift.TTransport
	ProtocolFactory thrift.TProtocolFactory
	InputProtocol   thrift.TProtocol
	OutputProtocol  thrift.TProtocol
	SeqId           int32
}

func NewIWfsClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *IWfsClient {
	return &IWfsClient{Transport: t,
		ProtocolFactory: f,
		InputProtocol:   f.GetProtocol(t),
		OutputProtocol:  f.GetProtocol(t),
		SeqId:           0,
	}
}

func NewIWfsClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *IWfsClient {
	return &IWfsClient{Transport: t,
		ProtocolFactory: nil,
		InputProtocol:   iprot,
		OutputProtocol:  oprot,
		SeqId:           0,
	}
}

func (p *IWfsClient) WfsPost(wf *WfsFile) (r *WfsAck, err error) {
	if err = p.sendWfsPost(wf); err != nil {
		return
	}
	return p.recvWfsPost()
}

func (p *IWfsClient) sendWfsPost(wf *WfsFile) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)

	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsPost", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsPostArgs{
		Wf: wf,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsPost() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsPost" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsPost failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsPost failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error1 error
		error1 = error0.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error1
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsPost failed: invalid message type")
		return
	}
	result := IWfsWfsPostResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

func (p *IWfsClient) WfsRead(name string) (r *WfsFile, err error) {
	if err = p.sendWfsRead(name); err != nil {
		return
	}
	return p.recvWfsRead()
}

func (p *IWfsClient) sendWfsRead(name string) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsRead", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsReadArgs{
		Name: name,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsRead() (value *WfsFile, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsRead" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsRead failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsRead failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error3 error
		error3 = error2.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error3
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsRead failed: invalid message type")
		return
	}
	result := IWfsWfsReadResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

func (p *IWfsClient) WfsDel(name string) (r *WfsAck, err error) {
	if err = p.sendWfsDel(name); err != nil {
		return
	}
	return p.recvWfsDel()
}

func (p *IWfsClient) sendWfsDel(name string) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)

	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsDel", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsDelArgs{
		Name: name,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsDel() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsDel" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsDel failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsDel failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error4 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error5 error
		error5 = error4.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error5
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsDel failed: invalid message type")
		return
	}
	result := IWfsWfsDelResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

func (p *IWfsClient) WfsCmd(wc *WfsCmd) (r *WfsAck, err error) {
	if err = p.sendWfsCmd(wc); err != nil {
		return
	}
	return p.recvWfsCmd()
}

func (p *IWfsClient) sendWfsCmd(wc *WfsCmd) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsCmd", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsCmdArgs{
		Wc: wc,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsCmd() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsCmd" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsCmd failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsCmd failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error6 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error7 error
		error7 = error6.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error7
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsCmd failed: invalid message type")
		return
	}
	result := IWfsWfsCmdResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

type IWfsProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      IWfs
}

func (p *IWfsProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *IWfsProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *IWfsProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewIWfsProcessor(handler IWfs) *IWfsProcessor {

	self8 := &IWfsProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self8.processorMap["wfsPost"] = &iWfsProcessorWfsPost{handler: handler}
	self8.processorMap["wfsRead"] = &iWfsProcessorWfsRead{handler: handler}
	self8.processorMap["wfsDel"] = &iWfsProcessorWfsDel{handler: handler}
	self8.processorMap["wfsCmd"] = &iWfsProcessorWfsCmd{handler: handler}
	return self8
}

func (p *IWfsProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {

	name, _, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return false, err
	}
	if processor, ok := p.GetProcessorFunction(name); ok {
		return processor.Process(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x9.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x9

}

type iWfsProcessorWfsPost struct {
	handler IWfs
}

func (p *iWfsProcessorWfsPost) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {

	args := IWfsWfsPostArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsPost", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsPostResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsPost(args.Wf); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsPost: "+err2.Error())
		oprot.WriteMessageBegin("wfsPost", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsPost", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsRead struct {
	handler IWfs
}

func (p *iWfsProcessorWfsRead) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {

	args := IWfsWfsReadArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsRead", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsReadResult{}
	var retval *WfsFile
	var err2 error
	if retval, err2 = p.handler.WfsRead(args.Name); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsRead: "+err2.Error())
		oprot.WriteMessageBegin("wfsRead", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsRead", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsDel struct {
	handler IWfs
}

func (p *iWfsProcessorWfsDel) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {

	args := IWfsWfsDelArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsDel", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsDelResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsDel(args.Name); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsDel: "+err2.Error())
		oprot.WriteMessageBegin("wfsDel", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsDel", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsCmd struct {
	handler IWfs
}

func (p *iWfsProcessorWfsCmd) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {

	args := IWfsWfsCmdArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsCmd", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsCmdResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsCmd(args.Wc); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsCmd: "+err2.Error())
		oprot.WriteMessageBegin("wfsCmd", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsCmd", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type IWfsWfsPostArgs struct {
	Wf *WfsFile `thrift:"wf,1" json:"wf"`
}

func NewIWfsWfsPostArgs() *IWfsWfsPostArgs {
	return &IWfsWfsPostArgs{}
}

var IWfsWfsPostArgs_Wf_DEFAULT *WfsFile

func (p *IWfsWfsPostArgs) GetWf() *WfsFile {
	if !p.IsSetWf() {
		return IWfsWfsPostArgs_Wf_DEFAULT
	}
	return p.Wf
}
func (p *IWfsWfsPostArgs) IsSetWf() bool {
	return p.Wf != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) readField1(iprot thrift.TProtocol) error {
	p.Wf = &WfsFile{}
	if err := p.Wf.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Wf), err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsPost_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("wf", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:wf: ", p), err)
	}
	if err := p.Wf.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Wf), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:wf: ", p), err)
	}
	return err
}

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

type IWfsWfsPostResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsPostResult() *IWfsWfsPostResult {
	return &IWfsWfsPostResult{}
}

var IWfsWfsPostResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsPostResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsPostResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsPostResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsPostResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsPostResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsPost_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsPostResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

type IWfsWfsReadArgs struct {
	Name string `thrift:"name,1" json:"name"`
}

func NewIWfsWfsReadArgs() *IWfsWfsReadArgs {
	return &IWfsWfsReadArgs{}
}

func (p *IWfsWfsReadArgs) GetName() string {
	return p.Name
}
func (p *IWfsWfsReadArgs) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsReadArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Name = v
	}
	return nil
}

func (p *IWfsWfsReadArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsRead_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsReadArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err)
	}
	if err := oprot.WriteString(string(p.Name)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err)
	}
	return err
}

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

type IWfsWfsReadResult struct {
	Success *WfsFile `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsReadResult() *IWfsWfsReadResult {
	return &IWfsWfsReadResult{}
}

var IWfsWfsReadResult_Success_DEFAULT *WfsFile

func (p *IWfsWfsReadResult) GetSuccess() *WfsFile {
	if !p.IsSetSuccess() {
		return IWfsWfsReadResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsReadResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsReadResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsFile{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsReadResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsRead_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsReadResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

type IWfsWfsDelArgs struct {
	Name string `thrift:"name,1" json:"name"`
}

func NewIWfsWfsDelArgs() *IWfsWfsDelArgs {
	return &IWfsWfsDelArgs{}
}

func (p *IWfsWfsDelArgs) GetName() string {
	return p.Name
}
func (p *IWfsWfsDelArgs) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsDelArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Name = v
	}
	return nil
}

func (p *IWfsWfsDelArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsDel_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsDelArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err)
	}
	if err := oprot.WriteString(string(p.Name)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err)
	}
	return err
}

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

type IWfsWfsDelResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsDelResult() *IWfsWfsDelResult {
	return &IWfsWfsDelResult{}
}

var IWfsWfsDelResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsDelResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsDelResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsDelResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsDelResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsDelResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsDel_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsDelResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

type IWfsWfsCmdArgs struct {
	Wc *WfsCmd `thrift:"wc,1" json:"wc"`
}

func NewIWfsWfsCmdArgs() *IWfsWfsCmdArgs {
	return &IWfsWfsCmdArgs{}
}

var IWfsWfsCmdArgs_Wc_DEFAULT *WfsCmd

func (p *IWfsWfsCmdArgs) GetWc() *WfsCmd {
	if !p.IsSetWc() {
		return IWfsWfsCmdArgs_Wc_DEFAULT
	}
	return p.Wc
}
func (p *IWfsWfsCmdArgs) IsSetWc() bool {
	return p.Wc != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) readField1(iprot thrift.TProtocol) error {
	p.Wc = &WfsCmd{}
	if err := p.Wc.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Wc), err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsCmd_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("wc", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:wc: ", p), err)
	}
	if err := p.Wc.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Wc), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:wc: ", p), err)
	}
	return err
}

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

type IWfsWfsCmdResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsCmdResult() *IWfsWfsCmdResult {
	return &IWfsWfsCmdResult{}
}

var IWfsWfsCmdResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsCmdResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsCmdResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsCmdResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsCmd_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

func (p *IWfsWfsCmdResult) String() string {
	if p == nil {
		return "<nil>"
	}
	return fmt.Sprintf("IWfsWfsCmdResult(%+v)", *p)
}
// Autogenerated by Thrift Compiler (0.9.3)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package protocol

import (
	"bytes"
	"context"
	"fmt"
	"git.apache.org/thrift.git/lib/go/thrift"
	"time"
)

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

type IWfs interface {
	// 上传
	//
	// Parameters:
	//  - Wf
	WfsPost(wf *WfsFile) (r *WfsAck, err error)
	// 拉取
	//
	// Parameters:
	//  - Name
	WfsRead(name string) (r *WfsFile, err error)
	// 删除
	//
	// Parameters:
	//  - Name
	WfsDel(name string) (r *WfsAck, err error)
	// 命令
	//
	// Parameters:
	//  - Wc
	WfsCmd(wc *WfsCmd) (r *WfsAck, err error)
}

type IWfsClient struct {
	Transport       thrift.TTransport
	ProtocolFactory thrift.TProtocolFactory
	InputProtocol   thrift.TProtocol
	OutputProtocol  thrift.TProtocol
	SeqId           int32
}

func NewIWfsClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *IWfsClient {
	return &IWfsClient{Transport: t,
		ProtocolFactory: f,
		InputProtocol:   f.GetProtocol(t),
		OutputProtocol:  f.GetProtocol(t),
		SeqId:           0,
	}
}

func NewIWfsClientProtocol(t thrift.TTransport, iprot thrift.TProtocol, oprot thrift.TProtocol) *IWfsClient {
	return &IWfsClient{Transport: t,
		ProtocolFactory: nil,
		InputProtocol:   iprot,
		OutputProtocol:  oprot,
		SeqId:           0,
	}
}

// 上传
//
// Parameters:
//  - Wf
func (p *IWfsClient) WfsPost(wf *WfsFile) (r *WfsAck, err error) {
	if err = p.sendWfsPost(wf); err != nil {
		return
	}
	return p.recvWfsPost()
}

func (p *IWfsClient) sendWfsPost(wf *WfsFile) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)

	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsPost", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsPostArgs{
		Wf: wf,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsPost() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsPost" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsPost failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsPost failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error0 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error1 error
		error1 = error0.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error1
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsPost failed: invalid message type")
		return
	}
	result := IWfsWfsPostResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

// 拉取
//
// Parameters:
//  - Name
func (p *IWfsClient) WfsRead(name string) (r *WfsFile, err error) {
	if err = p.sendWfsRead(name); err != nil {
		return
	}
	return p.recvWfsRead()
}

func (p *IWfsClient) sendWfsRead(name string) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsRead", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsReadArgs{
		Name: name,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsRead() (value *WfsFile, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsRead" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsRead failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsRead failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error2 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error3 error
		error3 = error2.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error3
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsRead failed: invalid message type")
		return
	}
	result := IWfsWfsReadResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

// 删除
//
// Parameters:
//  - Name
func (p *IWfsClient) WfsDel(name string) (r *WfsAck, err error) {
	if err = p.sendWfsDel(name); err != nil {
		return
	}
	return p.recvWfsDel()
}

func (p *IWfsClient) sendWfsDel(name string) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)

	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsDel", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsDelArgs{
		Name: name,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsDel() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsDel" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsDel failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsDel failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error4 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error5 error
		error5 = error4.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error5
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsDel failed: invalid message type")
		return
	}
	result := IWfsWfsDelResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

// 命令
//
// Parameters:
//  - Wc
func (p *IWfsClient) WfsCmd(wc *WfsCmd) (r *WfsAck, err error) {
	if err = p.sendWfsCmd(wc); err != nil {
		return
	}
	return p.recvWfsCmd()
}

func (p *IWfsClient) sendWfsCmd(wc *WfsCmd) (err error) {
	ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	oprot := p.OutputProtocol
	if oprot == nil {
		oprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.OutputProtocol = oprot
	}
	p.SeqId++
	if err = oprot.WriteMessageBegin("wfsCmd", thrift.CALL, p.SeqId); err != nil {
		return
	}
	args := IWfsWfsCmdArgs{
		Wc: wc,
	}
	if err = args.Write(oprot); err != nil {
		return
	}
	if err = oprot.WriteMessageEnd(); err != nil {
		return
	}
	return oprot.Flush(ctx)
}

func (p *IWfsClient) recvWfsCmd() (value *WfsAck, err error) {
	iprot := p.InputProtocol
	if iprot == nil {
		iprot = p.ProtocolFactory.GetProtocol(p.Transport)
		p.InputProtocol = iprot
	}
	method, mTypeId, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return
	}
	if method != "wfsCmd" {
		err = thrift.NewTApplicationException(thrift.WRONG_METHOD_NAME, "wfsCmd failed: wrong method name")
		return
	}
	if p.SeqId != seqId {
		err = thrift.NewTApplicationException(thrift.BAD_SEQUENCE_ID, "wfsCmd failed: out of sequence response")
		return
	}
	if mTypeId == thrift.EXCEPTION {
		error6 := thrift.NewTApplicationException(thrift.UNKNOWN_APPLICATION_EXCEPTION, "Unknown Exception")
		var error7 error
		error7 = error6.Read(iprot)
		if err != nil {
			return
		}
		if err = iprot.ReadMessageEnd(); err != nil {
			return
		}
		err = error7
		return
	}
	if mTypeId != thrift.REPLY {
		err = thrift.NewTApplicationException(thrift.INVALID_MESSAGE_TYPE_EXCEPTION, "wfsCmd failed: invalid message type")
		return
	}
	result := IWfsWfsCmdResult{}
	if err = result.Read(iprot); err != nil {
		return
	}
	if err = iprot.ReadMessageEnd(); err != nil {
		return
	}
	value = result.GetSuccess()
	return
}

type IWfsProcessor struct {
	processorMap map[string]thrift.TProcessorFunction
	handler      IWfs
}

func (p *IWfsProcessor) AddToProcessorMap(key string, processor thrift.TProcessorFunction) {
	p.processorMap[key] = processor
}

func (p *IWfsProcessor) GetProcessorFunction(key string) (processor thrift.TProcessorFunction, ok bool) {
	processor, ok = p.processorMap[key]
	return processor, ok
}

func (p *IWfsProcessor) ProcessorMap() map[string]thrift.TProcessorFunction {
	return p.processorMap
}

func NewIWfsProcessor(handler IWfs) *IWfsProcessor {

	self8 := &IWfsProcessor{handler: handler, processorMap: make(map[string]thrift.TProcessorFunction)}
	self8.processorMap["wfsPost"] = &iWfsProcessorWfsPost{handler: handler}
	self8.processorMap["wfsRead"] = &iWfsProcessorWfsRead{handler: handler}
	self8.processorMap["wfsDel"] = &iWfsProcessorWfsDel{handler: handler}
	self8.processorMap["wfsCmd"] = &iWfsProcessorWfsCmd{handler: handler}
	return self8
}

func (p *IWfsProcessor) Process(ctx context.Context, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	// ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	name, _, seqId, err := iprot.ReadMessageBegin()
	if err != nil {
		return false, err
	}
	if processor, ok := p.GetProcessorFunction(name); ok {
		return processor.Process(ctx, seqId, iprot, oprot)
	}
	iprot.Skip(thrift.STRUCT)
	iprot.ReadMessageEnd()
	x9 := thrift.NewTApplicationException(thrift.UNKNOWN_METHOD, "Unknown function "+name)
	oprot.WriteMessageBegin(name, thrift.EXCEPTION, seqId)
	x9.Write(oprot)
	oprot.WriteMessageEnd()
	oprot.Flush(ctx)
	return false, x9

}

type iWfsProcessorWfsPost struct {
	handler IWfs
}

func (p *iWfsProcessorWfsPost) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	// ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	args := IWfsWfsPostArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsPost", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsPostResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsPost(args.Wf); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsPost: "+err2.Error())
		oprot.WriteMessageBegin("wfsPost", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsPost", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsRead struct {
	handler IWfs
}

func (p *iWfsProcessorWfsRead) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	// ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	args := IWfsWfsReadArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsRead", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsReadResult{}
	var retval *WfsFile
	var err2 error
	if retval, err2 = p.handler.WfsRead(args.Name); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsRead: "+err2.Error())
		oprot.WriteMessageBegin("wfsRead", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsRead", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsDel struct {
	handler IWfs
}

func (p *iWfsProcessorWfsDel) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	// ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	args := IWfsWfsDelArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsDel", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsDelResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsDel(args.Name); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsDel: "+err2.Error())
		oprot.WriteMessageBegin("wfsDel", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsDel", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

type iWfsProcessorWfsCmd struct {
	handler IWfs
}

func (p *iWfsProcessorWfsCmd) Process(ctx context.Context, seqId int32, iprot, oprot thrift.TProtocol) (success bool, err thrift.TException) {
	// ctx, _ := context.WithTimeout(context.Background(), 10 * time.Second)
	args := IWfsWfsCmdArgs{}
	if err = args.Read(iprot); err != nil {
		iprot.ReadMessageEnd()
		x := thrift.NewTApplicationException(thrift.PROTOCOL_ERROR, err.Error())
		oprot.WriteMessageBegin("wfsCmd", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return false, err
	}

	iprot.ReadMessageEnd()
	result := IWfsWfsCmdResult{}
	var retval *WfsAck
	var err2 error
	if retval, err2 = p.handler.WfsCmd(args.Wc); err2 != nil {
		x := thrift.NewTApplicationException(thrift.INTERNAL_ERROR, "Internal error processing wfsCmd: "+err2.Error())
		oprot.WriteMessageBegin("wfsCmd", thrift.EXCEPTION, seqId)
		x.Write(oprot)
		oprot.WriteMessageEnd()
		oprot.Flush(ctx)
		return true, err2
	} else {
		result.Success = retval
	}
	if err2 = oprot.WriteMessageBegin("wfsCmd", thrift.REPLY, seqId); err2 != nil {
		err = err2
	}
	if err2 = result.Write(oprot); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.WriteMessageEnd(); err == nil && err2 != nil {
		err = err2
	}
	if err2 = oprot.Flush(ctx); err == nil && err2 != nil {
		err = err2
	}
	if err != nil {
		return
	}
	return true, err
}

// HELPER FUNCTIONS AND STRUCTURES

// Attributes:
//  - Wf
type IWfsWfsPostArgs struct {
	Wf *WfsFile `thrift:"wf,1" json:"wf"`
}

func NewIWfsWfsPostArgs() *IWfsWfsPostArgs {
	return &IWfsWfsPostArgs{}
}

var IWfsWfsPostArgs_Wf_DEFAULT *WfsFile

func (p *IWfsWfsPostArgs) GetWf() *WfsFile {
	if !p.IsSetWf() {
		return IWfsWfsPostArgs_Wf_DEFAULT
	}
	return p.Wf
}
func (p *IWfsWfsPostArgs) IsSetWf() bool {
	return p.Wf != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) readField1(iprot thrift.TProtocol) error {
	p.Wf = &WfsFile{}
	if err := p.Wf.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Wf), err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsPost_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsPostArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("wf", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:wf: ", p), err)
	}
	if err := p.Wf.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Wf), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:wf: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Success
type IWfsWfsPostResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsPostResult() *IWfsWfsPostResult {
	return &IWfsWfsPostResult{}
}

var IWfsWfsPostResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsPostResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsPostResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsPostResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsPostResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsPostResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsPost_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsPostResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

// Attributes:
//  - Name
type IWfsWfsReadArgs struct {
	Name string `thrift:"name,1" json:"name"`
}

func NewIWfsWfsReadArgs() *IWfsWfsReadArgs {
	return &IWfsWfsReadArgs{}
}

func (p *IWfsWfsReadArgs) GetName() string {
	return p.Name
}
func (p *IWfsWfsReadArgs) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsReadArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Name = v
	}
	return nil
}

func (p *IWfsWfsReadArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsRead_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsReadArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err)
	}
	if err := oprot.WriteString(string(p.Name)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Success
type IWfsWfsReadResult struct {
	Success *WfsFile `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsReadResult() *IWfsWfsReadResult {
	return &IWfsWfsReadResult{}
}

var IWfsWfsReadResult_Success_DEFAULT *WfsFile

func (p *IWfsWfsReadResult) GetSuccess() *WfsFile {
	if !p.IsSetSuccess() {
		return IWfsWfsReadResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsReadResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsReadResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsFile{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsReadResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsRead_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsReadResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

// Attributes:
//  - Name
type IWfsWfsDelArgs struct {
	Name string `thrift:"name,1" json:"name"`
}

func NewIWfsWfsDelArgs() *IWfsWfsDelArgs {
	return &IWfsWfsDelArgs{}
}

func (p *IWfsWfsDelArgs) GetName() string {
	return p.Name
}
func (p *IWfsWfsDelArgs) Read(iprot thrift.TProtocol) error {
	if _, err := iprot.ReadStructBegin(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read error: ", p), err)
	}

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsDelArgs) readField1(iprot thrift.TProtocol) error {
	if v, err := iprot.ReadString(); err != nil {
		return thrift.PrependError("error reading field 1: ", err)
	} else {
		p.Name = v
	}
	return nil
}

func (p *IWfsWfsDelArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsDel_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsDelArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("name", thrift.STRING, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:name: ", p), err)
	}
	if err := oprot.WriteString(string(p.Name)); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T.name (1) field write error: ", p), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:name: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Success
type IWfsWfsDelResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsDelResult() *IWfsWfsDelResult {
	return &IWfsWfsDelResult{}
}

var IWfsWfsDelResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsDelResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsDelResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsDelResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsDelResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsDelResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsDel_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsDelResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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

// Attributes:
//  - Wc
type IWfsWfsCmdArgs struct {
	Wc *WfsCmd `thrift:"wc,1" json:"wc"`
}

func NewIWfsWfsCmdArgs() *IWfsWfsCmdArgs {
	return &IWfsWfsCmdArgs{}
}

var IWfsWfsCmdArgs_Wc_DEFAULT *WfsCmd

func (p *IWfsWfsCmdArgs) GetWc() *WfsCmd {
	if !p.IsSetWc() {
		return IWfsWfsCmdArgs_Wc_DEFAULT
	}
	return p.Wc
}
func (p *IWfsWfsCmdArgs) IsSetWc() bool {
	return p.Wc != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 1:
			if err := p.readField1(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) readField1(iprot thrift.TProtocol) error {
	p.Wc = &WfsCmd{}
	if err := p.Wc.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Wc), err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsCmd_args"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField1(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsCmdArgs) writeField1(oprot thrift.TProtocol) (err error) {
	if err := oprot.WriteFieldBegin("wc", thrift.STRUCT, 1); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field begin error 1:wc: ", p), err)
	}
	if err := p.Wc.Write(oprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Wc), err)
	}
	if err := oprot.WriteFieldEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write field end error 1:wc: ", p), err)
	}
	return err
}

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

// Attributes:
//  - Success
type IWfsWfsCmdResult struct {
	Success *WfsAck `thrift:"success,0" json:"success,omitempty"`
}

func NewIWfsWfsCmdResult() *IWfsWfsCmdResult {
	return &IWfsWfsCmdResult{}
}

var IWfsWfsCmdResult_Success_DEFAULT *WfsAck

func (p *IWfsWfsCmdResult) GetSuccess() *WfsAck {
	if !p.IsSetSuccess() {
		return IWfsWfsCmdResult_Success_DEFAULT
	}
	return p.Success
}
func (p *IWfsWfsCmdResult) IsSetSuccess() bool {
	return p.Success != nil
}

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

	for {
		_, fieldTypeId, fieldId, err := iprot.ReadFieldBegin()
		if err != nil {
			return thrift.PrependError(fmt.Sprintf("%T field %d read error: ", p, fieldId), err)
		}
		if fieldTypeId == thrift.STOP {
			break
		}
		switch fieldId {
		case 0:
			if err := p.readField0(iprot); err != nil {
				return err
			}
		default:
			if err := iprot.Skip(fieldTypeId); err != nil {
				return err
			}
		}
		if err := iprot.ReadFieldEnd(); err != nil {
			return err
		}
	}
	if err := iprot.ReadStructEnd(); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T read struct end error: ", p), err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) readField0(iprot thrift.TProtocol) error {
	p.Success = &WfsAck{}
	if err := p.Success.Read(iprot); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T error reading struct: ", p.Success), err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) Write(oprot thrift.TProtocol) error {
	if err := oprot.WriteStructBegin("wfsCmd_result"); err != nil {
		return thrift.PrependError(fmt.Sprintf("%T write struct begin error: ", p), err)
	}
	if err := p.writeField0(oprot); err != nil {
		return err
	}
	if err := oprot.WriteFieldStop(); err != nil {
		return thrift.PrependError("write field stop error: ", err)
	}
	if err := oprot.WriteStructEnd(); err != nil {
		return thrift.PrependError("write struct stop error: ", err)
	}
	return nil
}

func (p *IWfsWfsCmdResult) writeField0(oprot thrift.TProtocol) (err error) {
	if p.IsSetSuccess() {
		if err := oprot.WriteFieldBegin("success", thrift.STRUCT, 0); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field begin error 0:success: ", p), err)
		}
		if err := p.Success.Write(oprot); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T error writing struct: ", p.Success), err)
		}
		if err := oprot.WriteFieldEnd(); err != nil {
			return thrift.PrependError(fmt.Sprintf("%T write field end error 0:success: ", p), err)
		}
	}
	return err
}

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