// Path: app/src/main/java/com/example/offline/model/Comment.java
// @Entity
// public class Comment implements Serializable {
// 
//     @PrimaryKey(autoGenerate = true)
//     private long id;
// 
//     @ColumnInfo(name = "photo_id")
//     private long photoId;
// 
//     @SerializedName("body")
//     @ColumnInfo(name = "comment_text")
//     private String commentText;
// 
//     @ColumnInfo(name = "timestamp")
//     private long timestamp;
// 
//     @ColumnInfo(name = "sync_pending")
//     private boolean syncPending;
// 
//     public long getId() {
//         return id;
//     }
// 
//     public long getPhotoId() {
//         return photoId;
//     }
// 
//     public String getCommentText() {
//         return commentText;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public boolean isSyncPending() {
//         return syncPending;
//     }
// 
//     @Ignore
//     public Comment(long photoId, String commentText) {
//         this.photoId = photoId;
//         this.commentText = commentText;
//         this.timestamp = System.currentTimeMillis();
//         this.syncPending = true;
//     }
// 
//     public Comment(long id, long photoId, String commentText, long timestamp, boolean syncPending) {
//         this.id = id;
//         this.photoId = photoId;
//         this.commentText = commentText;
//         this.timestamp = timestamp;
//         this.syncPending = syncPending;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("Comment id: %s, text: %s, syncPending: %s", id, commentText, syncPending);
//     }
// }


import com.example.offline.BuildConfig;
import com.example.offline.model.Comment;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import timber.log.Timber;
package com.example.offline.domain.services.networking;




public final class RemoteCommentService {

    private static RemoteCommentService instance;

    private final Retrofit retrofit;

    public RemoteCommentService() {

        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
        loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient httpClient = new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .build();

        Gson gson = new GsonBuilder()
                .excludeFieldsWithoutExposeAnnotation()
                .create();

        retrofit = new Retrofit.Builder()
                .client(httpClient)
                .baseUrl(BuildConfig.API_BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    public static synchronized RemoteCommentService getInstance() {
        if (instance == null) {
            instance = new RemoteCommentService();
        }
        return instance;
    }

// Path: app/src/main/java/com/example/offline/model/Comment.java
// @Entity
// public class Comment implements Serializable {
// 
//     @PrimaryKey(autoGenerate = true)
//     private long id;
// 
//     @ColumnInfo(name = "photo_id")
//     private long photoId;
// 
//     @SerializedName("body")
//     @ColumnInfo(name = "comment_text")
//     private String commentText;
// 
//     @ColumnInfo(name = "timestamp")
//     private long timestamp;
// 
//     @ColumnInfo(name = "sync_pending")
//     private boolean syncPending;
// 
//     public long getId() {
//         return id;
//     }
// 
//     public long getPhotoId() {
//         return photoId;
//     }
// 
//     public String getCommentText() {
//         return commentText;
//     }
// 
//     public long getTimestamp() {
//         return timestamp;
//     }
// 
//     public boolean isSyncPending() {
//         return syncPending;
//     }
// 
//     @Ignore
//     public Comment(long photoId, String commentText) {
//         this.photoId = photoId;
//         this.commentText = commentText;
//         this.timestamp = System.currentTimeMillis();
//         this.syncPending = true;
//     }
// 
//     public Comment(long id, long photoId, String commentText, long timestamp, boolean syncPending) {
//         this.id = id;
//         this.photoId = photoId;
//         this.commentText = commentText;
//         this.timestamp = timestamp;
//         this.syncPending = syncPending;
//     }
// 
//     @Override
//     public String toString() {
//         return String.format("Comment id: %s, text: %s, syncPending: %s", id, commentText, syncPending);
//     }
// }


// Path: app/src/main/java/com/example/offline/domain/services/networking/RemoteCommentService.java
import com.example.offline.BuildConfig;
import com.example.offline.model.Comment;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import java.io.IOException;
import okhttp3.OkHttpClient;
import okhttp3.logging.HttpLoggingInterceptor;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import timber.log.Timber;

package com.example.offline.domain.services.networking;




public final class RemoteCommentService {

    private static RemoteCommentService instance;

    private final Retrofit retrofit;

    public RemoteCommentService() {

        HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
        loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

        OkHttpClient httpClient = new OkHttpClient.Builder()
                .addInterceptor(loggingInterceptor)
                .build();

        Gson gson = new GsonBuilder()
                .excludeFieldsWithoutExposeAnnotation()
                .create();

        retrofit = new Retrofit.Builder()
                .client(httpClient)
                .baseUrl(BuildConfig.API_BASE_URL)
                .addConverterFactory(GsonConverterFactory.create(gson))
                .build();
    }

    public static synchronized RemoteCommentService getInstance() {
        if (instance == null) {
            instance = new RemoteCommentService();
        }
        return instance;
    }

    public void addComment(Comment comment) throws IOException, RemoteException {