import ForgejoKit
import SwiftUI

struct MergedPullRequestsOverviewView: View {
    let manager: MultiInstanceManager

    var body: some View {
        MergedSearchableOverviewView(
            manager: manager,
            config: .pullRequests,
            row: { issue, instanceName in
                PullRequestOverviewRow(issue: issue, instanceName: instanceName)
            },
            detail: { repository, number, auth in
                PullRequestDetailView(
                    repository: repository,
                    prNumber: number,
                    authService: auth,
                )
            },
            createView: { auth, onCreated in
                RepositoryPickerView(authService: auth) { repo in
                    PullRequestCreateView(
                        repository: repo,
                        authService: auth,
                        embeddedInNavigation: true,
                        onCreated: onCreated,
                    )
                }
            },
        )
    }
}
