//
//  LoxilyLocalize.h
//  iLocalizeSDK
//
//  Created by AIHelp on 2020/7/10.
//  Copyright © 2020 AIHelp. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "LoxilyLocalizeUserConfig.h"
#import "GGReviewResult.h"

/* callback for download string complete */
typedef void (*GGTranslationPreparedCallback)(bool success);

/* callback for screenshot review */
typedef void(^LoxilyReviewCompletion)(NSArray<GGReviewResult *> * _Nullable results, NSString * _Nullable summary, NSError * _Nullable error);

@interface LoxilyLocalize : NSObject

/**
 * Initialize Loxily Localize SDK
 *
 * When initializing Loxily Localize you must pass these three tokens. You initialize Loxily Localize by adding the following lines in the implementation file for your app delegate, ideally at the top of application:didFinishLaunchingWithOptions
 * If you want to use a test string file, refer to the initialization method below
 * @param appKey This is your developer API Key
 * @param isInternationalizing  We did accelerations for different regions.  set true for international, set false for China
 * @param language  This is the init  language
 */
+ (void)initWithAppKey:(NSString *)appKey
              language:(NSString *)language
  isInternationalizing:(BOOL)isInternationalizing;

/**
 * Initialize Loxily Localize SDK
 *
 * When initializing Loxily Localize you must pass these three tokens. You initialize Loxily Localize by adding the following lines in the implementation file for your app delegate, ideally at the top of application:didFinishLaunchingWithOptions
 * @param appKey This is your developer API Key
 * @param language  This is the init  language
 * @param isInternationalizing  We did accelerations for different regions.  set true for international, set false for China
 * @param isDebug  It may be useful to you during debugging. The default is false. If true, it will download the debug string file
 */
+ (void)initWithAppKey:(NSString *)appKey
              language:(NSString *)language
  isInternationalizing:(BOOL)isInternationalizing
               isDebug:(BOOL)isDebug;

/**
 * Gets the corresponding string based on the code
 *
 * The code needs to correspond to the Loxily Localize website one to one
 * @param code string code, it is required
 * @return The string you want, If no string is found, an empty string is returned
 */
+ (NSString *)getStringWithCode:(NSString *)code;

/**
 * Gets the corresponding string string based on the code
 *
 * The code needs to correspond to the Loxily Localize website one to one
 * @param code string code, it is required
 * @param defaultString The default string
 * @return The string you want, If no string is found, defaultString will be returned
 */
+ (NSString *)getStringWithCode:(NSString *)code defaultString:(NSString *)defaultString;

/**
 * Change the string language
 *
 * The call will fail in the following cases :
 * 1. If a Loxily Localize session is already active at the time of invocation
 * 2. Language code is incorrect
 * 3. Corresponding localization file is not found
 * @param lan the string representing the language code. For example, use 'fr' for French.
 */
+ (void)updateLanguage:(NSString *)lan;

/**
 * Register callback for download string complete
 *
 * It will tell you whether the download succeeded or failed
 * @param callBack callBack for download string complete
 */
+ (void)setTranslationPreparedCallback:(GGTranslationPreparedCallback)callBack;

/**
 * Whether to print logs.
 *
 * It only works in Debug mode
 * @param enable YES/NO
 */
+ (void)setLogEnable:(BOOL)enable;
 
+ (void)evaluateStringWithCode:(NSString *)code stringContent:(NSString *)stringContent;

+ (void)setUserConfig:(LoxilyLocalizeUserConfig *)config;

+ (void)evaluateAllStrings;

+ (void)checkStringOverflow:(LoxilyLocalizeCheckOverflowConfig *)config;

+ (void)enableEvaluateFunction:(BOOL)enable;

/**
 * 截图翻译审查（带回调）
 * 截取当前页面截图，通过 AI 多模态分析文本，匹配平台 string_id 并返回翻译修改建议
 *
 * @param viewController 当前视图控制器
 * @param callback 审查结果回调
 */
+ (void)reviewCurrentScreenWithViewController:(UIViewController *)viewController
                                     callback:(LoxilyReviewCompletion)callback;

/**
 * 截图翻译审查（内置 UI）
 * 截取当前页面截图，通过 AI 分析后在内置浮层中展示审查结果
 *
 * @param viewController 当前视图控制器
 */
+ (void)reviewCurrentScreenWithViewController:(UIViewController *)viewController;

@end

