package com.silverpop.api.client.result;

import java.util.List;

import com.silverpop.api.client.ApiResult;
import com.silverpop.api.client.result.elements.GetJobStatusParameter;
import com.silverpop.api.client.result.elements.GetJobStatusParameters;
import com.thoughtworks.xstream.annotations.XStreamAlias;

public class GetJobStatusResult implements ApiResult {

    @XStreamAlias("JOB_ID")
    private String jobId;

    @XStreamAlias("SUCCESS")
    private boolean successElement;

    @XStreamAlias("JOB_STATUS")
    private String jobStatus;

    @XStreamAlias("JOB_DESCRIPTION")
    private String jobDescription;

    @XStreamAlias("PARAMETERS")
    private GetJobStatusParameters parameters;


    public String getJobId() {
        return jobId;
    }

    public boolean isSuccessElement() {
        return successElement;
    }

    public String getJobStatus() {
        return jobStatus;
    }

    public String getJobDescription() {
        return jobDescription;
    }
    
    public List<GetJobStatusParameter> getParameters() {
        return parameters.getParameters();
    }

}

@@ -843,30 +843,33 @@
 %0A    public 
-String
+JobStatus
  getJobStatu
@@ -886,220 +886,723 @@
     
-return jobStatus;%0A    %7D%0A%0A    public String getJobDescription() %7B%0A        return jobDescription;%0A    %7D%0A    %0A    public List%3CGetJobStatusParameter%3E getParameters() %7B%0A        return parameters.getParameters();%0A    %7D%0A
+JobStatus status;%0A        try %7B%0A            status = JobStatus.valueOf(jobStatus);%0A        %7D catch (IllegalArgumentException ex) %7B%0A            // use the UNKNOWN value instead, Silverpop must have introduced a new valid value%0A            status = JobStatus.UNKNOWN;%0A        %7D%0A        return status;%0A    %7D%0A%0A    public String getJobDescription() %7B%0A        return jobDescription;%0A    %7D%0A    %0A    public List%3CGetJobStatusParameter%3E getParameters() %7B%0A        return parameters.getParameters();%0A    %7D%0A%0A%0A    public static enum JobStatus %7B%0A%0A        WAITING,%0A        RUNNING,%0A        CANCELED,%0A        ERROR,%0A        COMPLETE,%0A%0A        /** Only used if Silverpop introduced a new value for JOB_STATUS */%0A        UNKNOWN%0A%0A    %7D
 %0A%7D%0A

return an enum instead of a String for job status