//
//  MyAdServer.h
//  nochange
//
//  Created by mac on 2024/7/26.
//

#ifndef MyAdServer_h
#define MyAdServer_h

#import <Foundation/Foundation.h>
#import "XSHttpHelper.h"

typedef struct {
    NSNumber *loads;
    NSNumber *adTouchBeforeMs;
    NSNumber *adTouchAfterMs;
    NSNumber *adTime;
    NSNumber *adTimeout;
    NSNumber *touchRate;
} AdLoadInfo;

typedef void (^ChangeDataSaveCallback)(NSDictionary* dic);
typedef void (^AdLoadInfoCallback)(AdLoadInfo* info);
typedef void (^LowEcpmCallback)(NSNumber* ecpm);

typedef struct {
    NSString *taskId;
    NSString *title;
    NSString *message;
    NSString *idfa;
    NSString *appid;
    NSString *adid;
    NSString *iphoneId;
    NSString *ipAddr;
    NSNumber *ecpm;
    int level;
} AdTaskLogData;
void getChangeInfo(NSString* idfa, ChangeDataSaveCallback callback, error_callback errorCallback);
BOOL saveChangeDataFile (NSDictionary * data);
void pushAdTaskLog(AdTaskLogData *data);
void pushInfo(int type, NSString *data, rt_str_callback callback,error_callback errorCallback);
AdLoadInfo getAdLoadInfo(NSDictionary *request);
void pushIphoneLog(NSString *data);
void registerSignalHandler(void);
void saveAdTaskLog(NSDictionary *dic);
void getLowEcpm(LowEcpmCallback callback);
BOOL needAdContinue(NSString *appid, NSString *idfa, NSNumber *maxEcpm);
#endif /* MyAdServer_h */
