func (st *CreateReportComment) Run() (string, error) {
	err := data.NewComment(st.reportID, data.CustomTime{time.Now()}, st.Comment)
	if err != nil {
		return response.StatusMsg(fmt.Sprintf("CreateReportComment failed: %q", err), st.start), nil
	}
	return response.StatusMsg("Comment created.", st.start), nil
}
func (st *CreateReportVote) Run() (string, error) {
	err := data.Vote(st.reportID)
	if err != nil {
		return response.StatusMsg(fmt.Sprintf("CreateReportVote failed: %q", err), st.start), nil
	}
	return response.StatusMsg("Vote logged.", st.start), nil
}
func (st *UpdateThreeOneOne) Run() (string, error) {
	err := data.UpdateSLA(st.reportID, st.TicketSLA)
	if err != nil {
		return response.StatusMsg(fmt.Sprintf("Update failed: %q", err), st.start), nil
	}
	return response.StatusMsg("Report updated.", st.start), nil
}
func Process(input string, start time.Time) (string, error) {
	rt, e := newRequest(input, start)
	if e != nil {
		msg := fmt.Sprintf("Error while parsing the request: %q", e)
		log.Warning("%s", msg)
		return response.StatusMsg(msg, start), errors.New(msg)
	}

	if ok := rt.auth(); !ok {
		msg := "Invalid auth code"
		log.Warning("%s", msg)
		return response.StatusMsg(msg, start), errors.New(msg)
	}

	// Create an instance of the request struct
	svcName, ok := typeRegistry[rt.ApiRequestType]
	log.Info("[%s] received", svcName)
	if !ok {
		msg := fmt.Sprintf("Unknown request received: %s", rt.ApiRequestType)
		log.Warning(msg)
		return response.StatusMsg(msg, start), e
	}
	svc := reflect.New(svcName).Interface()

	// Unmarshal into it
	err := xml.Unmarshal([]byte(input), svc)
	if err != nil {
		msg := fmt.Sprintf("Unable to unmarshal GetReportsByLatLng request: %s", err)
		log.Warning(msg)
		return "", errors.New(msg)
	}

	// Validate
	errmsg := svc.(Processor).Validate(start)
	if errmsg != "" {
		msg := fmt.Sprintf("Invalid request - %s", errmsg)
		log.Warning(msg)
		resp := response.StatusMsg(msg, start)
		return resp, nil

	}

	// Run
	rsp, err := svc.(Processor).Run()

	log.Debug("Response:\n%s\n", rsp)
	if err != nil {
		log.Warning("Request failed - error: %s", err)
	}

	return rsp, err
}