import Foundation

public protocol Commentable: Equatable {
    var commentEntityId: String { get }
    var commentEntityType: CommentEntity.CommentEntityType { get }

    /// The user handle of the entity's author/creator
    var authorUserHandle: String { get }
}

public extension Commentable {
    var isClip: Bool {
        commentEntityType == .clip
    }

    var isHook: Bool {
        commentEntityType == .hook
    }
}

extension Hook: Commentable {
    public var commentEntityId: String {
        return id
    }

    public var commentEntityType: CommentEntity.CommentEntityType {
        return .hook
    }

    public var authorUserHandle: String {
        return user?.handle ?? ""
    }
}
