//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
//
// Copyright (c) 2015-2016 Marcus Rohrmoser http://mro.name/me. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
//

#import <Availability.h>

#ifndef __IPHONE_8_0
#warning "This project uses features only available in iOS SDK 8.0 and later."
#endif

#ifdef __OBJC__
    #import <UIKit/UIKit.h>
    #import <Foundation/Foundation.h>


#ifndef DEBUG
#error explicitly define - either 0 or 1
#endif

#if DEBUG
#define RELEASE_VERSION 0
// #define MRLogD(fmt, ...)      NSLog(fmt, __VA_ARGS__)
#define MRLogD(fmt, ...)      NSLog(@"#%d %s " fmt, __LINE__, __FUNCTION__, __VA_ARGS__)
#define MRLogTStart()         const NSTimeInterval debug_timer_start = [[NSProcessInfo processInfo] systemUptime]
#define MRLogT(s, ... )       MRLogD(@"dt=%f " s, ([[NSProcessInfo processInfo] systemUptime] - debug_timer_start), __VA_ARGS__)
#else
#define RELEASE_VERSION 1
#define MRLogD( s, ... )
#define MRLogTStart()
#define MRLogT(s, ... )
#endif

#define MRLogW(fmt, ...)       NSLog(@"WARN  #%d %s " fmt, __LINE__, __FUNCTION__, __VA_ARGS__)
#define MRLogE(fmt, ...)       NSLog(@"ERROR #%d %s " fmt, __LINE__, __FUNCTION__, __VA_ARGS__)

// Switch NSAssert checks on and off according to DEBUG_MODE
#if DEBUG
#ifdef NS_BLOCK_ASSERTIONS
#error Don't define -DNS_BLOCK_ASSERTIONS=0 in Project Settings->GCC 4.2 Language->Other C Flags
#endif
#else
// we can either
// - set the macro here
#define NS_BLOCK_ASSERTIONS 1
// - or just check the NS_BLOCK_ASSERTIONS setting (must be done in build settings then)
#ifndef NS_BLOCK_ASSERTIONS
#error Define -DNS_BLOCK_ASSERTIONS=1 in Project Settings->GCC 4.2 Language->Other C Flags
#endif
#if !NS_BLOCK_ASSERTIONS
#error Define -DNS_BLOCK_ASSERTIONS=1 in Project Settings->GCC 4.2 Language->Other C Flags
#endif
#endif



#define BUNDLE_ID @"name.mro.ShaarliOS"
#define SELF_URL_PREFIX @"name-mro-shaarlios"
#define SHAARLI_COMPANION_APP_URL @"http://app.mro.name/ShaarliOS"

#define SHAARLI_ERROR_DOMAIN BUNDLE_ID

#define SHAARLI_ERROR_BANNED 2
#define SHAARLI_ERROR_LOGOUT_BUTTON_EXPECTED 3
#define SHAARLI_ERROR_TITLE_EXPECTED 4
#define SHAARLI_ERROR_NO_TOKEN 5
#define SHAARLI_ERROR_NO_LINK_ADDED 6
#define SHAARLI_ERROR_POST_FALLTHROUGH 7
#define SHAARLI_ERROR_UNKNOWN 8

#define HTTP_POST @"POST"
#define HTTP_GET @"GET"
#define HTTP_HTTP @"http"
#define HTTP_HTTPS HTTP_HTTP @"s"

#define HTML_ON @"on"

#define F_K_TOKEN @"token"
#define F_K_LOGIN @"login"
#define F_K_PASSWORD @"password"
#define F_K_RETURNURL @"returnurl"

#define K_F_SOURCE @"source"
#define K_F_POST @"post"
#define K_F_TITLE @"title"
#define K_F_DESCRIPTION @"description"

#define K_F_LF_SOURCE @"lf_" K_F_SOURCE
#define K_F_LF_TITLE @"lf_" K_F_TITLE
#define K_F_LF_DESCRIPTION @"lf_" K_F_DESCRIPTION
#define K_F_LF_URL @"lf_url"
#define K_F_LF_TAGS @"lf_tags"
#define K_F_LF_PRIVATE @"lf_private"

#endif

