import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.core.Runtime;
import jade.wrapper.AgentContainer;

/**
 * Program 2: Watcher + modified Provider demo
 *
 * W1 monitors for Service3 violations.
 * P1 (Service1 only)          – not a violator, runs undisturbed
 * P2 (Service3, no Service1)  – violator; ignores ForbiddenSrvc → force-killed after 5s
 * P3 (Service1+Service2+3)    – violator; has Service1 → self-deletes on ForbiddenSrvc
 * P4 (Service2+Service3)      – violator; no Service1 → force-killed after 5s
 */
public class Run2 {
    public static void main(String[] args) throws Exception {

        Runtime rt = Runtime.instance();
        rt.setCloseVM(true);

        ProfileImpl mainProf = new ProfileImpl();
        mainProf.setParameter(Profile.GUI, "true");
        AgentContainer mainC = rt.createMainContainer(mainProf);

        mainC.createNewAgent("W1", "agents.Watcher", new Object[]{}).start();
        Thread.sleep(500);

        mainC.createNewAgent("P1", "agents.Provider", new Object[]{"1","0","0"}).start();
        Thread.sleep(1500);

        mainC.createNewAgent("P2", "agents.Provider", new Object[]{"0","0","1"}).start();
        Thread.sleep(3000);

        mainC.createNewAgent("P3", "agents.Provider", new Object[]{"1","1","1"}).start();
        Thread.sleep(2000);

        mainC.createNewAgent("P4", "agents.Provider", new Object[]{"0","1","1"}).start();
    }
}
