package org.slc.sli.test.generators;

import java.util.Random;

import org.slc.sli.test.edfi.entities.AcademicSubjectType;
import org.slc.sli.test.edfi.entities.ContentStandardType;
import org.slc.sli.test.edfi.entities.GradeLevelType;
import org.slc.sli.test.edfi.entities.LearningStandard;
import org.slc.sli.test.edfi.entities.LearningStandardId;
import org.slc.sli.test.edfi.entities.LearningStandardIdentityType;
import org.slc.sli.test.edfi.entities.LearningStandardReferenceType;

public class LearningStandardGenerator {
    private ContentStandardType[] csts = ContentStandardType.values();
    private GradeLevelType[] glts = GradeLevelType.values();
    private AcademicSubjectType[] asts = AcademicSubjectType.values();

    private Random random = new Random();

    private boolean optional = true;

    public LearningStandardGenerator(boolean optional) {
        this.optional = optional;
    }

    public LearningStandard generate(String learningStandardCode) {
        LearningStandard ls = new LearningStandard();

        ls.setId(learningStandardCode);

        LearningStandardId lsid = new LearningStandardId();
        lsid.setContentStandardName(learningStandardCode + "Name");
        lsid.setIdentificationCode(learningStandardCode);
        ls.setLearningStandardId(lsid);

        ls.setDescription(learningStandardCode + " Descriptions");

        ls.setContentStandard(csts[random.nextInt(csts.length)]);

        ls.setGradeLevel(glts[random.nextInt(glts.length)]);

        ls.setSubjectArea(asts[random.nextInt(asts.length)]);

        if (optional) {
            ls.setCourseTitle(learningStandardCode + " CourseTitle");
        }

        return ls;
    }

    public static LearningStandard generateLoFi(String learningStandardCode) {
        LearningStandardGenerator lsg = new LearningStandardGenerator(false);
        return lsg.generate(learningStandardCode);
    }

    public static LearningStandardReferenceType getLearningStandardReferenceType(String learningStandardCode) {
        LearningStandardReferenceType lsrt = new LearningStandardReferenceType();

        lsrt.setRef(learningStandardCode);

        LearningStandardId lsid = new LearningStandardId();
        lsid.setContentStandardName(learningStandardCode + "Name");
        lsid.setIdentificationCode(learningStandardCode);
        LearningStandardIdentityType lsit = new LearningStandardIdentityType();
        lsit.setLearningStandardId(lsid);
        lsrt.setLearningStandardIdentity(lsit);

        return lsrt;
    }
}

@@ -526,399 +526,74 @@
 r %7B%0A
-    private ContentStandardType%5B%5D csts = ContentStandardType.values();%0A    private GradeLevelType%5B%5D glts = GradeLevelType.values();%0A    private AcademicSubjectType%5B%5D asts = AcademicSubjectType.values();%0A%0A    private Random random = new Random();%0A%0A    private boolean optional = true;%0A%0A    public LearningStandardGenerator(boolean optional) %7B%0A        this.optional = optional;%0A    %7D%0A%0A    publ
+%0A    private static Random random = new Random();%0A%0A    public stat
 ic L
@@ -616,16 +616,21 @@
 generate
+LowFi
 (String 
@@ -1078,198 +1078,304 @@
 ard(
-csts%5Brandom.nextInt(csts.length)%5D);%0A%0A        ls.setGradeLevel(glts%5Brandom.nextInt(glts.length)%5D);%0A%0A        ls.setSubjectArea(asts%5Brandom.nextInt(asts.length)%5D);%0A%0A        if (optional) %7B%0A    
+ContentStandardType.values()%5Brandom.nextInt(ContentStandardType.values().length)%5D);%0A%0A        ls.setGradeLevel(GradeLevelType.values()%5Brandom.nextInt(GradeLevelType.values().length)%5D);%0A%0A        ls.setSubjectArea(AcademicSubjectType.values()%5Brandom.nextInt(AcademicSubjectType.values().length)%5D);%0A%0A
     
@@ -1439,18 +1439,8 @@
 e%22);
-%0A        %7D
 %0A%0A  
@@ -1501,426 +1501,85 @@
 dard
- generateLoFi(String learningStandardCode) %7B%0A        LearningStandardGenerator lsg = new LearningStandardGenerator(false);%0A        return lsg.generate(learningStandardCode);%0A    %7D%0A%0A    public static LearningStandardReferenceType getLearningStandardReferenceType(String learningStandardCode) %7B%0A        LearningStandardReferenceType lsrt = new LearningStandardReferenceType();%0A%0A        lsrt.setRef(learningStandardCode);
+ReferenceType getLearningStandardReferenceType(String learningStandardCode) %7B
 %0A%0A  
@@ -1754,32 +1754,33 @@
 gStandardCode);%0A
+%0A
         Learning
@@ -1884,16 +1884,99 @@
 d(lsid);
+%0A%0A        LearningStandardReferenceType lsrt = new LearningStandardReferenceType();
 %0A       

make generators static