import Foundation

public struct CommentReactionResponse: Codable {
    enum CodingKeys: String, CodingKey {
        case id
        case numLikes = "num_likes"
        case reactionType = "reaction_type"
    }

    public let id: String // Comment ID
    public let numLikes: Int // Number of Likes
    public let reactionType: String? // <"LIKE" | "DISLIKE">

    public var reaction: CommentReactionType {
        return CommentReactionType(reactionType)
    }

    init(_ remote: Components.Schemas.CommentReactionResponse) throws {
        id = remote.id ?? ""
        numLikes = remote.num_likes ?? .zero
        reactionType = remote.reaction_type
    }
}
