package org.netmelody.cii.domain;

import static java.util.Arrays.asList;

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

public final class Target {

    private final String id;
    private final String name;
    private final Status status;
    private final List<Sponsor> guilty = new ArrayList<Sponsor>();
    private final List<Build> builds = new ArrayList<Build>();
    
    public Target(String name) {
        this(name, Status.GREEN);
    }

    public Target(String name, Status status, Build... builds) {
        this(name, name, status, builds);
    }
    
    public Target(String id, String name, Status status, Build... builds) {
        this(id, name, status, new ArrayList<Sponsor>(), builds);
    }
    
    public Target(String id, String name, Status status, List<Sponsor> guilty, Build... builds) {
        this.id = id;
        this.name = name;
        this.status = status;
        this.guilty.addAll(guilty);
        
        if (null != builds) {
            this.builds.addAll(asList(builds));
        }
    }

    public String id() {
        return id;
    }
    
    public String name() {
        return name;
    }
    
    public Status status() {
        return status;
    }
    
    public List<Sponsor> guilty() {
        return new ArrayList<Sponsor>(guilty);
    }
}

@@ -274,22 +274,24 @@
 ponsor%3E 
-guilty
+sponsors
  = new A
@@ -795,22 +795,24 @@
 ponsor%3E 
-guilty
+sponsors
 , Build.
@@ -919,28 +919,32 @@
 his.
-guilty.addAll(guilty
+sponsors.addAll(sponsors
 );%0A 
@@ -1248,22 +1248,24 @@
 ponsor%3E 
-guilty
+sponsors
 () %7B%0A   
@@ -1303,14 +1303,16 @@
 or%3E(
-guilty
+sponsors
 );%0A 

rename guilty to sponsors