package com.expidev.gcmapp.model;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Created by William.Randall on 2/3/2015.
 */
public class AssociatedMinistry extends Ministry
{
    @Nullable
    private String parentMinistryId;
    private String ministryCode;
    private boolean hasSlm;
    private boolean hasLlm;
    private boolean hasDs;
    private boolean hasGcm;
    private double latitude;
    private double longitude;
    private int locationZoom;

    @NonNull
    private final List<AssociatedMinistry> subMinistries = new ArrayList<>();

    @Nullable
    public String getParentMinistryId() {
        return parentMinistryId;
    }

    public void setParentMinistryId(@Nullable final String parentMinistryId) {
        this.parentMinistryId = parentMinistryId;
    }

    public String getMinistryCode()
    {
        return ministryCode;
    }

    public void setMinistryCode(String ministryCode)
    {
        this.ministryCode = ministryCode;
    }

    public boolean hasSlm()
    {
        return hasSlm;
    }

    public void setHasSlm(boolean hasSlm)
    {
        this.hasSlm = hasSlm;
    }

    public boolean hasLlm()
    {
        return hasLlm;
    }

    public void setHasLlm(boolean hasLlm)
    {
        this.hasLlm = hasLlm;
    }

    public boolean hasDs()
    {
        return hasDs;
    }

    public void setHasDs(boolean hasDs)
    {
        this.hasDs = hasDs;
    }

    public boolean hasGcm()
    {
        return hasGcm;
    }

    public void setHasGcm(boolean hasGcm)
    {
        this.hasGcm = hasGcm;
    }

    public double getLatitude() {
        return latitude;
    }

    public void setLatitude(final double latitude) {
        this.latitude = latitude;
    }

    public double getLongitude() {
        return longitude;
    }

    public void setLongitude(final double longitude) {
        this.longitude = longitude;
    }

    public int getLocationZoom() {
        return locationZoom;
    }

    public void setLocationZoom(final int locationZoom) {
        this.locationZoom = locationZoom;
    }

    @NonNull
    public List<AssociatedMinistry> getSubMinistries()
    {
        return Collections.unmodifiableList(subMinistries);
    }

    public void setSubMinistries(@Nullable final List<AssociatedMinistry> ministries) {
        this.subMinistries.clear();
        if (ministries != null) {
            this.subMinistries.addAll(ministries);
        }
    }
}

@@ -171,17 +171,72 @@
 llection
-s
+;%0Aimport java.util.Collections;%0Aimport java.util.EnumSet
 ;%0Aimport
@@ -447,113 +447,80 @@
     
-private boolean hasSlm;%0A    private boolean hasLlm;%0A    private boolean hasDs;%0A    private boolean hasGcm
+@NonNull%0A    private final EnumSet%3CMcc%3E mccs = EnumSet.noneOf(Mcc.class)
 ;%0A  
@@ -1109,32 +1109,391 @@
 tryCode;%0A    %7D%0A%0A
+    @NonNull%0A    public EnumSet%3CMcc%3E getMccs() %7B%0A        return EnumSet.copyOf(this.mccs);%0A    %7D%0A%0A    public boolean hasMcc(@NonNull final Mcc mcc) %7B%0A        return this.mccs.contains(mcc);%0A    %7D%0A%0A    public void setMccs(final Collection%3CMcc%3E mccs) %7B%0A        this.mccs.clear();%0A        if (mccs != null) %7B%0A            this.mccs.addAll(mccs);%0A        %7D%0A    %7D%0A%0A
     public boole
@@ -1524,27 +1524,36 @@
   return has
-Slm
+Mcc(Mcc.SLM)
 ;%0A    %7D%0A%0A   
@@ -1609,29 +1609,123 @@
     
-this.
+if (
 hasSlm
- = hasSlm;
+) %7B%0A            this.mccs.add(Mcc.SLM);%0A        %7D else %7B%0A            this.mccs.remove(Mcc.SLM);%0A        %7D
 %0A   
@@ -1776,27 +1776,36 @@
   return has
-Llm
+Mcc(Mcc.LLM)
 ;%0A    %7D%0A%0A   
@@ -1861,29 +1861,123 @@
     
-this.
+if (
 hasLlm
- = hasLlm;
+) %7B%0A            this.mccs.add(Mcc.LLM);%0A        %7D else %7B%0A            this.mccs.remove(Mcc.LLM);%0A        %7D
 %0A   
@@ -2027,26 +2027,35 @@
   return has
-Ds
+Mcc(Mcc.DS)
 ;%0A    %7D%0A%0A   
@@ -2109,27 +2109,120 @@
     
-this.hasDs = hasDs;
+if (hasDs) %7B%0A            this.mccs.add(Mcc.DS);%0A        %7D else %7B%0A            this.mccs.remove(Mcc.DS);%0A        %7D
 %0A   
@@ -2273,27 +2273,36 @@
   return has
-Gcm
+Mcc(Mcc.GCM)
 ;%0A    %7D%0A%0A   
@@ -2358,29 +2358,123 @@
     
-this.
+if (
 hasGcm
- = hasGcm;
+) %7B%0A            this.mccs.add(Mcc.GCM);%0A        %7D else %7B%0A            this.mccs.remove(Mcc.GCM);%0A        %7D
 %0A   

update AssociatedMinistry to internally use the Mcc enum