// Path: joshlong-emon/src/main/java/com/example/logic/OrderedPicProvider.java
// public class OrderedPicProvider implements PictureProvider {
// 
//     private final List<String> pics;
//     private Iterator<String> iterator;
// 
//     public OrderedPicProvider(List<String> pics) {
//         this.pics = sortPics(pics);
//         this.iterator = pics.iterator();
//     }
// 
//     private List<String> sortPics(final List<String> pics) {
//         List<String> copy = new ArrayList<>(pics);
//         Collections.sort(copy);
// 
//         return copy;
//     }
// 
//     @Override
//     public String getNextPicture() {
//         if (iterator.hasNext()) {
//             return iterator.next();
//         } else {
//             this.iterator = this.pics.iterator();
//             return iterator.next();
//         }
//     }
// }
// 
// Path: joshlong-emon/src/main/java/com/example/logic/PictureProvider.java
// public interface PictureProvider {
// 
//     String getNextPicture();
// }
// 
// Path: joshlong-emon/src/main/java/com/example/logic/RandomPicProvider.java
// public class RandomPicProvider implements PictureProvider {
// 
//     private final static Random RAND = new Random();
// 
//     private final List<String> pics;
// 
//     public RandomPicProvider(final List<String> pics) {
//         this.pics = pics;
//     }
// 
//     @Override
//     public String getNextPicture() {
//         return pics.get(RAND.nextInt(pics.size()));
//     }
// }


import com.example.logic.OrderedPicProvider;
import com.example.logic.PictureProvider;
import com.example.logic.RandomPicProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;
package com.example;



@Configuration
@ComponentScan("com.example.controller")
@ConditionalOnWebApplication
public class JoshLongEmonAutoConfiguration {

    private static final List<String> wildPokemon;

    static {
        wildPokemon = new ArrayList<>();

        wildPokemon.add("https://pbs.twimg.com/media/CpAEg2WUkAA46Xk.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/CpAFCCgVIAAZbGB.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_5W8rVYAEcW5g.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_m3YiUEAAUCXw.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_EWBgVYAAnPME.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-tpclUIAI7sFC.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-j-c2UIAALN-o.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-YP1ZUsAA0y8q.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-SqeGUsAEgADj.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-WR0mVMAAxv4y.jpg");
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnProperty(prefix = "josh.long", name = "pics", havingValue = "random")
    public PictureProvider randomizedJoshLongPicProvider() {
        return new RandomPicProvider(wildPokemon);
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnProperty(prefix = "josh.long", name = "pics", havingValue = "ordered")
    public PictureProvider orderedJoshLongPicProvider() {
// Path: joshlong-emon/src/main/java/com/example/logic/OrderedPicProvider.java
// public class OrderedPicProvider implements PictureProvider {
// 
//     private final List<String> pics;
//     private Iterator<String> iterator;
// 
//     public OrderedPicProvider(List<String> pics) {
//         this.pics = sortPics(pics);
//         this.iterator = pics.iterator();
//     }
// 
//     private List<String> sortPics(final List<String> pics) {
//         List<String> copy = new ArrayList<>(pics);
//         Collections.sort(copy);
// 
//         return copy;
//     }
// 
//     @Override
//     public String getNextPicture() {
//         if (iterator.hasNext()) {
//             return iterator.next();
//         } else {
//             this.iterator = this.pics.iterator();
//             return iterator.next();
//         }
//     }
// }
// 
// Path: joshlong-emon/src/main/java/com/example/logic/PictureProvider.java
// public interface PictureProvider {
// 
//     String getNextPicture();
// }
// 
// Path: joshlong-emon/src/main/java/com/example/logic/RandomPicProvider.java
// public class RandomPicProvider implements PictureProvider {
// 
//     private final static Random RAND = new Random();
// 
//     private final List<String> pics;
// 
//     public RandomPicProvider(final List<String> pics) {
//         this.pics = pics;
//     }
// 
//     @Override
//     public String getNextPicture() {
//         return pics.get(RAND.nextInt(pics.size()));
//     }
// }


// Path: joshlong-emon/src/main/java/com/example/JoshLongEmonAutoConfiguration.java
import com.example.logic.OrderedPicProvider;
import com.example.logic.PictureProvider;
import com.example.logic.RandomPicProvider;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import java.util.ArrayList;
import java.util.List;

package com.example;



@Configuration
@ComponentScan("com.example.controller")
@ConditionalOnWebApplication
public class JoshLongEmonAutoConfiguration {

    private static final List<String> wildPokemon;

    static {
        wildPokemon = new ArrayList<>();

        wildPokemon.add("https://pbs.twimg.com/media/CpAEg2WUkAA46Xk.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/CpAFCCgVIAAZbGB.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_5W8rVYAEcW5g.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_m3YiUEAAUCXw.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co_EWBgVYAAnPME.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-tpclUIAI7sFC.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-j-c2UIAALN-o.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-YP1ZUsAA0y8q.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-SqeGUsAEgADj.jpg");
        wildPokemon.add("https://pbs.twimg.com/media/Co-WR0mVMAAxv4y.jpg");
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnProperty(prefix = "josh.long", name = "pics", havingValue = "random")
    public PictureProvider randomizedJoshLongPicProvider() {
        return new RandomPicProvider(wildPokemon);
    }

    @Bean
    @ConditionalOnMissingBean
    @ConditionalOnProperty(prefix = "josh.long", name = "pics", havingValue = "ordered")
    public PictureProvider orderedJoshLongPicProvider() {
        return new OrderedPicProvider(wildPokemon);