/*
 * Copyright 2012 Shared Learning Collaborative, LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


package org.slc.sli.test.edfi.entities.meta;

import java.util.Set;
import java.util.HashSet;

import org.slc.sli.test.edfi.entities.meta.relations.MetaRelations;

public class ProgramMeta {

    public Set<String> staffIds;
    public Set<String> studentIds;

    public Set<String> cohortIds;

    public String orgId; // this is used in generating studentProgram associations
    
    public final String id;

    public ProgramMeta(String id, SchoolMeta schoolMeta) {
        this.id = schoolMeta.id + MetaRelations.ID_DELIMITER + id;

        staffIds = new HashSet<String>();
        studentIds = new HashSet<String>();

        cohortIds = new HashSet<String>();

        orgId = schoolMeta.id;
    }
    
    
    public ProgramMeta(String id, SeaMeta seaMeta) {
        this.id = seaMeta.id + MetaRelations.ID_DELIMITER + id;

        staffIds = new HashSet<String>();
        studentIds = new HashSet<String>();

        cohortIds = new HashSet<String>();

        orgId = seaMeta.id;
    }
    
    public ProgramMeta(String id, LeaMeta leaMeta) {
        this.id = leaMeta.id + MetaRelations.ID_DELIMITER + id;

        staffIds = new HashSet<String>();
        studentIds = new HashSet<String>();

        cohortIds = new HashSet<String>();

        orgId = leaMeta.id;
    }

    @Override
    public String toString() {
        return "ProgramMeta [id=" + id + ", staffIds=" + staffIds + ",studentIds=" + studentIds + 
                             ",cohortIds=" + cohortIds + "]";
    }

}

@@ -1016,24 +1016,60 @@
 l String id;
+%0A    private static int uniquer = 0;
 %0A%0A    public
@@ -1174,32 +1174,73 @@
 D_DELIMITER + id
+ + MetaRelations.ID_DELIMITER + uniquer++
 ;%0A%0A        staff
@@ -1511,32 +1511,73 @@
 D_DELIMITER + id
+ + MetaRelations.ID_DELIMITER + uniquer++
 ;%0A%0A        staff
@@ -1778,32 +1778,32 @@
 Meta leaMeta) %7B%0A
-
         this.id 
@@ -1848,16 +1848,57 @@
 TER + id
+ + MetaRelations.ID_DELIMITER + uniquer++
 ;%0A%0A     

make sure ProgramId is unique