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

import Foundation
import Get
import URLQueryEncoder

extension Paths.Marketplace.Projects.WithProjectId.Submissions.WithSubmissionId {
    public var accept: Accept {
        Accept(path: path + "/accept")
    }

    public struct Accept {
        /// Path: `/api/marketplace/projects/{project_id}/submissions/{submission_id}/accept`
        public let path: String

        /// Accept Submission
        ///
        /// Accept a submission and optionally complete the project (creator only)
        /// 
        /// Args:
        ///     close_project: If True, completes the project and transfers credits.
        ///                    If False, only marks the submission as accepted without closing.
        ///                    Defaults to True for backward compatibility.
        public func post(closeProject: Bool? = nil) -> Request<GenAPI.ProjectResponse> {
            Request(path: path, method: "POST", query: makePostQuery(closeProject), id: "studio_api_marketplace_api_accept_submission")
        }

        private func makePostQuery(_ closeProject: Bool?) -> [(String, String?)] {
            let encoder = URLQueryEncoder()
            encoder.encode(closeProject, forKey: "close_project")
            return encoder.items
        }
    }
}
