//
//  PushAPI.swift
//  suixinkan
//
//  Created by Codex on 2026/6/26.
//

import Foundation
import Combine

@MainActor
/// 推送 API，负责把 iOS APNs token 上报到当前后端兼容接口。
final class PushAPI {
    private let client: APIClient

    /// 初始化推送 API，并注入共享网络客户端。
    init(client: APIClient) {
        self.client = client
    }

    /// 上报 APNs device token。后端当前沿用 Android/JPush 字段名。
    func registerJPushId(_ registrationId: String) async throws {
        let _: EmptyPayload = try await client.send(
            APIRequest(
                method: .post,
                path: "/api/app/user/register-jpush-id",
                queryItems: [URLQueryItem(name: "jpush_reg_id", value: registrationId)]
            )
        )
    }
}
