// Path: src/main/java/org/ominidi/domain/model/Feed.java
// @Getter
// public class Feed<Post> implements Iterable<Post> {
//     private final List<Post> posts;
//     private final String nextUrl;
//     private final String prevUrl;
//     private final Integer size;
// 
//     public Feed(List<Post> posts, String nextUrl, String prevUrl) {
//         this.posts = posts;
//         this.size = posts.size();
//         this.nextUrl = nextUrl;
//         this.prevUrl = prevUrl;
//     }
// 
//     @Override
//     public Iterator<Post> iterator() {
//         return posts.iterator();
//     }
// 
//     public Integer size() {
//         return posts.size();
//     }
// }
// 
// Path: src/main/java/org/ominidi/domain/model/Post.java
// @Getter
// public class Post {
//     private final String id;
//     private final String objectId;
//     private final String createdTime;
//     private final String type;
//     private final String link;
//     private final String permalinkUrl;
//     private final String picture;
//     private final String fullPicture;
//     private final String message;
// 
//     public Post(
//             String id,
//             String objectId,
//             String createdTime,
//             String type,
//             String link,
//             String permalinkUrl,
//             String picture,
//             String fullPicture,
//             String message
//     ) {
//         this.id = id;
//         this.objectId = objectId;
//         this.createdTime = createdTime;
//         this.type = type;
//         this.link = link;
//         this.permalinkUrl = permalinkUrl;
//         this.picture = picture;
//         this.fullPicture = fullPicture;
//         this.message = message;
//     }
// }


import com.restfb.Connection;
import com.restfb.json.JsonObject;
import org.ominidi.domain.model.Feed;
import org.ominidi.domain.model.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.stream.Collectors;

package org.ominidi.facebook.mapper;



@Component
public class FeedMapper implements FromType<Connection<JsonObject>, Feed<Post>> {
    private PostMapper postMapper;

    @Autowired
    public FeedMapper(PostMapper postMapper) {
        this.postMapper = postMapper;
    }

    @Override
    public Feed<Post> fromType(Connection<JsonObject> toMap) {

// Path: src/main/java/org/ominidi/domain/model/Feed.java
// @Getter
// public class Feed<Post> implements Iterable<Post> {
//     private final List<Post> posts;
//     private final String nextUrl;
//     private final String prevUrl;
//     private final Integer size;
// 
//     public Feed(List<Post> posts, String nextUrl, String prevUrl) {
//         this.posts = posts;
//         this.size = posts.size();
//         this.nextUrl = nextUrl;
//         this.prevUrl = prevUrl;
//     }
// 
//     @Override
//     public Iterator<Post> iterator() {
//         return posts.iterator();
//     }
// 
//     public Integer size() {
//         return posts.size();
//     }
// }
// 
// Path: src/main/java/org/ominidi/domain/model/Post.java
// @Getter
// public class Post {
//     private final String id;
//     private final String objectId;
//     private final String createdTime;
//     private final String type;
//     private final String link;
//     private final String permalinkUrl;
//     private final String picture;
//     private final String fullPicture;
//     private final String message;
// 
//     public Post(
//             String id,
//             String objectId,
//             String createdTime,
//             String type,
//             String link,
//             String permalinkUrl,
//             String picture,
//             String fullPicture,
//             String message
//     ) {
//         this.id = id;
//         this.objectId = objectId;
//         this.createdTime = createdTime;
//         this.type = type;
//         this.link = link;
//         this.permalinkUrl = permalinkUrl;
//         this.picture = picture;
//         this.fullPicture = fullPicture;
//         this.message = message;
//     }
// }


// Path: src/main/java/org/ominidi/facebook/mapper/FeedMapper.java
import com.restfb.Connection;
import com.restfb.json.JsonObject;
import org.ominidi.domain.model.Feed;
import org.ominidi.domain.model.Post;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.stream.Collectors;

package org.ominidi.facebook.mapper;



@Component
public class FeedMapper implements FromType<Connection<JsonObject>, Feed<Post>> {
    private PostMapper postMapper;

    @Autowired
    public FeedMapper(PostMapper postMapper) {
        this.postMapper = postMapper;
    }

    @Override
    public Feed<Post> fromType(Connection<JsonObject> toMap) {

        List<Post> posts = toMap.getData().stream().map(jsonObject -> new Post(
