//
//  GMBookConsultViewModel.m
//  AFNetworking
//
//  Created by Jessica on 2020/7/20.
//

#import "GMBookConsultViewModel.h"

@implementation GMBookConsultViewModel
+ (void)bookConsultInfoWithWithRecordId:(NSString *)recordId successBlock:(HttpSuccessBlock)successBlock failBlock:(HttpFailedBlock)failBlock {
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:SafeString(recordId) forKey:@"record_id"];
    [GMNetworking requestOCWithApi:@"/api/consultation_counsel/conuslt_user_appointment" method:GMHTTPMethodGet parameters:params completion:^(GMResponseOC *responseObject) {
        if (responseObject.isSuccess) {
            successBlock(responseObject);
        } else {
            failBlock(responseObject.message);
        }
    }];
}

+ (void)bookConsultWithRecordId:(NSString *)recordId requestId:(NSInteger)requestId successBlock:(HttpSuccessBlock)successBlock failBlock:(HttpFailedBlock)failBlock {
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    [params setObject:SafeString(recordId) forKey:@"record_id"];
    [params setObject:@(requestId) forKey:@"request_id"];
    [params setObject:SafeString([PhobosUtil currentTime]) forKey:@"appointment_time"];
    [GMNetworking requestOCWithApi:@"/api/sales_lead/consult_appointment" method:GMHTTPMethodPost parameters:params completion:^(GMResponseOC *responseObject) {
        if (responseObject.isSuccess) {
            successBlock(responseObject);
        } else {
            failBlock(responseObject.message);
        }
    }];
}
@end
