// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/history/History.java
// public class History {
// 
//     private List<Call> calls;
// 
//     public History(Set<Member> conversationMember) {
//         List<Member> sortedMembers = new ArrayList<>(conversationMember);
//         sortedMembers.sort(Member::startedBefore);
//         calls = sortedMembers.stream().map(Member::toCall).collect(toList());
//     }
// 
//     public List<Call> getCalls() {
//         return calls;
//     }
// }


import org.nextrtc.examples.videochat_with_rest.domain.history.History;
import javax.persistence.*;
import java.util.Set;
    @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
    private Set<Member> conversationMember;

    @Deprecated
    User() {
    }

    public User(String username, String password, String email, String confirmationKey) {
        this.username = username;
        this.password = password;
        this.email = email;
        this.confirmationKey = confirmationKey;
    }

    public User(String username, String email, String authProviderId) {
        this.username = username;
        this.email = email;
        this.authProviderId = authProviderId;
        confirmed = true;
    }

    public String getUsername() {
        return username;
    }

    public void confirmEmail() {
        confirmed = true;
    }

    public History prepareHistory() {
// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/history/History.java
// public class History {
// 
//     private List<Call> calls;
// 
//     public History(Set<Member> conversationMember) {
//         List<Member> sortedMembers = new ArrayList<>(conversationMember);
//         sortedMembers.sort(Member::startedBefore);
//         calls = sortedMembers.stream().map(Member::toCall).collect(toList());
//     }
// 
//     public List<Call> getCalls() {
//         return calls;
//     }
// }


// Path: src/main/java/org/nextrtc/examples/videochat_with_rest/domain/User.java
import org.nextrtc.examples.videochat_with_rest.domain.history.History;
import javax.persistence.*;
import java.util.Set;

    @OneToMany(mappedBy = "user", fetch = FetchType.LAZY)
    private Set<Member> conversationMember;

    @Deprecated
    User() {
    }

    public User(String username, String password, String email, String confirmationKey) {
        this.username = username;
        this.password = password;
        this.email = email;
        this.confirmationKey = confirmationKey;
    }

    public User(String username, String email, String authProviderId) {
        this.username = username;
        this.email = email;
        this.authProviderId = authProviderId;
        confirmed = true;
    }

    public String getUsername() {
        return username;
    }

    public void confirmEmail() {
        confirmed = true;
    }

    public History prepareHistory() {
        return new History(conversationMember);