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

import Foundation
import Get
import URLQueryEncoder

extension Paths.Comment.User {
    public func identifier(_ identifier: String) -> WithIdentifier {
        WithIdentifier(path: "\(path)/\(identifier)")
    }

    public struct WithIdentifier {
        /// Path: `/api/comment/user/{identifier}`
        public let path: String

        /// Get Clip Comments By User
        ///
        /// Get paginated clip comments by user with cursor-based pagination.
        public func get(parameters: GetParameters? = nil) -> Request<GenAPI.GetCommentsResponse> {
            Request(path: path, method: "GET", query: parameters?.asQuery, id: "studio_api_bots_comment_api_get_clip_comments_by_user")
        }

        public struct GetParameters {
            public var idType: IdType?
            public var cursor: String?
            public var pageSize: Int?

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

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

                public static let handle = Self(rawValue: "handle")
                public static let email = Self(rawValue: "email")
                public static let phoneNumber = Self(rawValue: "phone_number")
            }

            public init(idType: IdType? = nil, cursor: String? = nil, pageSize: Int? = nil) {
                self.idType = idType
                self.cursor = cursor
                self.pageSize = pageSize
            }

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

        /// Delete Clip Comments By User
        ///
        /// Delete all clip comments for a user.
        public func delete(idType: IdType? = nil) -> Request<GenAPI.DeleteCommentResponse> {
            Request(path: path, method: "DELETE", query: makeDeleteQuery(idType), id: "studio_api_bots_comment_api_delete_clip_comments_by_user")
        }

        private func makeDeleteQuery(_ idType: IdType?) -> [(String, String?)] {
            let encoder = URLQueryEncoder()
            encoder.encode(idType, forKey: "id_type")
            return encoder.items
        }

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

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

            public static let handle = Self(rawValue: "handle")
            public static let email = Self(rawValue: "email")
            public static let phoneNumber = Self(rawValue: "phone_number")
        }
    }
}
