// Path: api/src/main/java/hirez/api/SessionStorage.java
// public interface SessionStorage {
//     SessionStorage DEFAULT = CachedSessionStorage.create();
// 
//     String get() throws NullPointerException;
// 
//     void get(Consumer<String> session);
// 
//     void set(CreateSession session);
// 
//     boolean isPresent();
// }
// 
// Path: api/src/main/java/hirez/api/object/CreateSession.java
// @Data
// public class CreateSession implements ReturnedMessage {
//     @JsonProperty("ret_msg")
//     private String returnedMessage;
//     private String sessionId;
//     @DateTimeFormat
//     private Date timestamp;
// 
// }


import hirez.api.SessionStorage;
import hirez.api.object.CreateSession;
import java.util.function.Consumer;
package hirez.api.sessions;



public class CachedSessionStorage implements SessionStorage {
    private String session;

    public static SessionStorage create() {
        return new CachedSessionStorage();
    }

    @Override
    public String get() throws NullPointerException {
        if (isPresent())
            return session;
        else
            throw new NullPointerException("Please register session first!");
    }

    @Override
    public void get(Consumer<String> session) {
        try {
            session.accept(get());
        } catch (Throwable ignore) {
        }
    }

    @Override
// Path: api/src/main/java/hirez/api/SessionStorage.java
// public interface SessionStorage {
//     SessionStorage DEFAULT = CachedSessionStorage.create();
// 
//     String get() throws NullPointerException;
// 
//     void get(Consumer<String> session);
// 
//     void set(CreateSession session);
// 
//     boolean isPresent();
// }
// 
// Path: api/src/main/java/hirez/api/object/CreateSession.java
// @Data
// public class CreateSession implements ReturnedMessage {
//     @JsonProperty("ret_msg")
//     private String returnedMessage;
//     private String sessionId;
//     @DateTimeFormat
//     private Date timestamp;
// 
// }


// Path: api/src/main/java/hirez/api/sessions/CachedSessionStorage.java
import hirez.api.SessionStorage;
import hirez.api.object.CreateSession;
import java.util.function.Consumer;

package hirez.api.sessions;



public class CachedSessionStorage implements SessionStorage {
    private String session;

    public static SessionStorage create() {
        return new CachedSessionStorage();
    }

    @Override
    public String get() throws NullPointerException {
        if (isPresent())
            return session;
        else
            throw new NullPointerException("Please register session first!");
    }

    @Override
    public void get(Consumer<String> session) {
        try {
            session.accept(get());
        } catch (Throwable ignore) {
        }
    }

    @Override
    public void set(CreateSession session) {