#import <Foundation/Foundation.h>

/**
 * Native fire-and-forget reporter for `/report_status/deploy` failures.
 *
 * Built so failure detail can be POSTed the **moment** it occurs in native
 * code, without waiting for the React Native bridge to come up. Intentionally
 * mirrors the wire format produced by the JS-side `CodePushApiSdk.reportStatusDeploy`
 * so the server sees identical payloads regardless of which path produced them.
 *
 * Reads server URL / deployment key / client unique ID / app version /
 * telemetry flags from `[CodePushConfig current]`. Honours both
 * `dataTransmissionEnabled` and `telemetryEnabled` — if either is off, the
 * call is a no-op (matching JS-side behaviour).
 *
 * Network errors are silently swallowed; the existing
 * `saveFailedUpdate(__codePushFailureInfo) + needToReportRollback=YES`
 * persistence still runs alongside this, providing a next-sync fallback.
 *
 * NOT exposed in the public CodePush.h header — intended for internal use
 * only by the native failure-reporting hot paths.
 */
@interface CodePushDeployReporter : NSObject

/**
 * @param failedPackage Optional. The package whose deployment failed. When
 *                      provided, contributes `label` and `app_version` (the
 *                      package's `appVersion`, i.e. target binary range) to
 *                      the request body. May be nil for a binary-only context.
 * @param errorCode     Recommended values from the FailureErrorCode dictionary
 *                      (NETWORK_ERROR / HASH_MISMATCH / UNZIP_FAILED /
 *                      SIGNATURE_INVALID / DISK_FULL / BUNDLE_LOAD_FAILED /
 *                      NATIVE_CRASH / USER_ROLLBACK / TIMEOUT / UNKNOWN).
 *                      Capped at 64 chars; nil/empty defaults to "UNKNOWN".
 * @param errorMessage  Optional free-form text. Capped at 500 chars.
 * @param failedPhase   One of: download / install / runtime / unknown.
 *                      Anything else is coerced to "unknown". Capped at 20 chars.
 */
+ (void)reportFailureWithPackage:(NSDictionary *)failedPackage
                       errorCode:(NSString *)errorCode
                    errorMessage:(NSString *)errorMessage
                     failedPhase:(NSString *)failedPhase;

@end
