package com.socialapp.data.api import com.squareup.moshi.Json import retrofit2.Response import retrofit2.http.* // Auth DTOs data class RegisterRequest( @Json(name = "username") val username: String, @Json(name = "email") val email: String, @Json(name = "password") val password: String ) data class LoginRequest( @Json(name = "email") val email: String, @Json(name = "password") val password: String ) data class AuthResponse( @Json(name = "user_id") val userId: Int, @Json(name = "username") val username: String, @Json(name = "email") val email: String, @Json(name = "token") val token: String, @Json(name = "profile_image") val profileImage: String? = null ) // User DTOs data class UserProfile( @Json(name = "id") val id: Int, @Json(name = "username") val username: String, @Json(name = "bio") val bio: String?, @Json(name = "profile_image") val profileImage: String?, @Json(name = "cover_photo") val coverPhoto: String?, @Json(name = "followers_count") val followersCount: Int, @Json(name = "following_count") val followingCount: Int, @Json(name = "posts_count") val postsCount: Int, @Json(name = "verified") val verified: Boolean = false ) // Post DTOs data class Post( @Json(name = "id") val id: Int, @Json(name = "user_id") val userId: Int, @Json(name = "username") val username: String, @Json(name = "profile_image") val profileImage: String?, @Json(name = "content") val content: String, @Json(name = "media_url") val mediaUrl: List? = null, @Json(name = "likes_count") val likesCount: Int, @Json(name = "comments_count") val commentsCount: Int, @Json(name = "is_liked") val isLiked: Boolean, @Json(name = "created_at") val createdAt: String, @Json(name = "updated_at") val updatedAt: String ) // Comment DTOs data class Comment( @Json(name = "id") val id: Int, @Json(name = "user_id") val userId: Int, @Json(name = "username") val username: String, @Json(name = "profile_image") val profileImage: String?, @Json(name = "content") val content: String, @Json(name = "created_at") val createdAt: String ) data class CommentRequest( @Json(name = "content") val content: String ) // Story DTOs data class Story( @Json(name = "id") val id: Int, @Json(name = "user_id") val userId: Int, @Json(name = "username") val username: String, @Json(name = "profile_image") val profileImage: String?, @Json(name = "media_url") val mediaUrl: String, @Json(name = "expires_at") val expiresAt: String, @Json(name = "created_at") val createdAt: String ) // Like Request data class LikeRequest( @Json(name = "post_id") val postId: Int ) // Follow Response data class FollowResponse( @Json(name = "status") val status: String, @Json(name = "following") val following: Boolean ) // Paginated Response data class PaginatedResponse( @Json(name = "data") val data: List, @Json(name = "current_page") val currentPage: Int, @Json(name = "last_page") val lastPage: Int, @Json(name = "total") val total: Int ) // API Service Interface interface ApiService { // Auth @POST("api/auth/register") suspend fun register(@Body request: RegisterRequest): Response @POST("api/auth/login") suspend fun login(@Body request: LoginRequest): Response // User @GET("api/user/{id}") suspend fun getUserProfile(@Path("id") userId: Int): Response @GET("api/user/me") suspend fun getCurrentUser(): Response @PUT("api/user/profile") suspend fun updateProfile(@Body profile: UserProfile): Response // Posts @GET("api/posts") suspend fun getPosts( @Query("page") page: Int = 1, @Query("limit") limit: Int = 20 ): Response> @GET("api/user/{id}/posts") suspend fun getUserPosts( @Path("id") userId: Int, @Query("page") page: Int = 1 ): Response> @POST("api/posts") suspend fun createPost(@Body post: Post): Response @GET("api/posts/{id}") suspend fun getPost(@Path("id") postId: Int): Response @DELETE("api/posts/{id}") suspend fun deletePost(@Path("id") postId: Int): Response> // Likes @POST("api/posts/{id}/like") suspend fun likePost(@Path("id") postId: Int): Response> @DELETE("api/posts/{id}/like") suspend fun unlikePost(@Path("id") postId: Int): Response> // Comments @GET("api/posts/{id}/comments") suspend fun getComments( @Path("id") postId: Int, @Query("page") page: Int = 1 ): Response> @POST("api/posts/{id}/comment") suspend fun addComment( @Path("id") postId: Int, @Body request: CommentRequest ): Response @DELETE("api/comments/{id}") suspend fun deleteComment(@Path("id") commentId: Int): Response> // Follow @POST("api/follow/{id}") suspend fun followUser(@Path("id") userId: Int): Response @DELETE("api/follow/{id}") suspend fun unfollowUser(@Path("id") userId: Int): Response @GET("api/user/{id}/followers") suspend fun getFollowers(@Path("id") userId: Int): Response> @GET("api/user/{id}/following") suspend fun getFollowing(@Path("id") userId: Int): Response> // Stories @GET("api/stories") suspend fun getStories(): Response> @POST("api/stories") suspend fun createStory(@Body story: Story): Response @DELETE("api/stories/{id}") suspend fun deleteStory(@Path("id") storyId: Int): Response> }