import ForgejoKit
import SwiftUI

struct MergedIssuesOverviewView: View {
    let manager: MultiInstanceManager

    var body: some View {
        MergedSearchableOverviewView(
            manager: manager,
            config: .issues,
            row: { issue, instanceName in
                IssueRow(issue: issue, instanceName: instanceName)
            },
            detail: { repository, number, auth in
                IssueDetailView(
                    repository: repository,
                    issueNumber: number,
                    authService: auth,
                )
            },
            createView: { auth, onCreated in
                RepositoryPickerView(authService: auth) { repo in
                    IssueCreateView(
                        repository: repo,
                        authService: auth,
                        embeddedInNavigation: true,
                        onCreated: onCreated,
                    )
                }
            },
        )
    }
}
