import ForgejoKit

struct RepositoryMetadata {
    var labels: [IssueLabel] = []
    var milestones: [IssueMilestone] = []
    var assignees: [User] = []
}

func loadRepositoryMetadata(service: RepositoryService, owner: String, repo: String) async -> RepositoryMetadata {
    async let labels = try? service.fetchLabels(owner: owner, repo: repo)
    async let milestones = try? service.fetchMilestones(owner: owner, repo: repo)
    async let assignees = try? service.fetchAssignees(owner: owner, repo: repo)
    return await RepositoryMetadata(
        labels: labels ?? [],
        milestones: milestones ?? [],
        assignees: assignees ?? [],
    )
}
