// Generated by Create API
// https://github.com/CreateAPI/CreateAPI

import Foundation
import Get
import URLQueryEncoder

extension Paths.Video.Hooks.Comments.WithHookId {
    public var comments: Comments {
        Comments(path: path + "/comments")
    }

    public struct Comments {
        /// Path: `/api/video/hooks/comments/{hook_id}/comments`
        public let path: String

        /// Get Comments
        ///
        /// Get comments for a clip.
        public func get(parameters: GetParameters? = nil) -> Request<GenAPI.GetCommentsResponse> {
            Request(path: path, method: "GET", query: parameters?.asQuery, id: "studio_api_video_hooks_comments_api_get_comments")
        }

        public struct GetParameters {
            public var cursor: String?
            public var pageSize: Int?
            public var order: Order?
            public var id: String?
            public var deeplink: Bool?

            public struct Order: RawRepresentable, Codable, Equatable {
                public let rawValue: String

                public init(rawValue: String) {
                    self.rawValue = rawValue
                }

                public static let newest = Self(rawValue: "newest")
                public static let oldest = Self(rawValue: "oldest")
                public static let mostLiked = Self(rawValue: "most_liked")
            }

            public init(cursor: String? = nil, pageSize: Int? = nil, order: Order? = nil, id: String? = nil, deeplink: Bool? = nil) {
                self.cursor = cursor
                self.pageSize = pageSize
                self.order = order
                self.id = id
                self.deeplink = deeplink
            }

            public var asQuery: [(String, String?)] {
                let encoder = URLQueryEncoder()
                encoder.encode(cursor, forKey: "cursor")
                encoder.encode(pageSize, forKey: "page_size")
                encoder.encode(order, forKey: "order")
                encoder.encode(id, forKey: "id")
                encoder.encode(deeplink, forKey: "deeplink")
                return encoder.items
            }
        }
    }
}
