package com.telephoners.krakyournet.ctf.objects;

import java.util.Random;

/**
 * Created by gpietrus on 20.02.2016.
 */
public class Flag {
    private String value;
    private static int flagLength = 32;

    public Flag() {
    }

    public Flag(String value) {
        this.value = value;
    }

    public static Flag newRandomFlag() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("AGH_CTF_");
        for(int i = 0; i < flagLength; i++) {
            char c = (char) (new Random().nextInt(128 - 32) + 32);
            stringBuilder.append(c);
        }
        return new Flag(stringBuilder.toString());
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
}
