/* 
** Written completely by Liang Hongbin
**
*/

#ifndef TARIFF__H
#define TARIFF__H
#include "ramdata.h"

#define PERIODIC_CHARGE_HOUR     9
#define PERIODIC_CHARGE_MINUTE   0
#define PERIODIC_CHARGE_SECOND   0
#define	PERIODIC_OF_DAY			24
#define	MAX_MEGA_SIZE			34
#define	PRIVATE_TARIFF_SIZE		(MAX_MEGA_SIZE*1024*1024)

typedef struct {
	_comm_tariff			comm_tariff[MAX_ZONE_NUM];
	_rent_tariff			rent_tariff[MAX_ZONE_NUM][MAX_RENT_TARIFF];
    _bill_tariff				bill_tariff[MAX_ZONE_NUM][BILLING_BASE_NUM];
	_bill_tariff			called_tariff[MAX_ZONE_NUM][CALLED_BASE_NUM];
	u_char				bill_discount[MAX_DISCOUNT_ID][PERIODIC_OF_DAY][8];
	u_char				holiday_flag[12][31];
	_bill_sms				bill_sms[MAX_ZONE_NUM][MAX_SMS_PREFIX];
	_gprs_tariff			gprs_tariff[MAX_ZONE_NUM][MAX_GPRS_PREFIX];
	VAS_TARIFF			vas_tariff[MAX_ZONE_NUM];
} _tariff_private;



#define PPS_PREFIX_NODE_NUM     (MAX_ZONE_NUM_NEW*4096)
typedef struct
{
        u_short           sub[14];
        u_char            flag;                   //bit0=0/1: prefix not exist/exist;bit1=0/1:prefix not exist in sub node/exist
        u_short           prefix_index;
}_pps_prefix_node;

//_pps_prefix_node pps_prefix_table[MAX_ZONE_NUM_NEW][PPS_PREFIX_NODE_NUM];
//_pps_prefix_node pps_prefix_table[PPS_PREFIX_NODE_NUM];
/* the ZONE NUM is as a prefix or a separate table is for further study,
if the ZONE NUM is as prefix , then should not be larger than 16 */


int ListCurrentTariff(int zone_id);
void ListTariffPlan();
void ListCurrentTariffWithMsisdn(char *number);


int  pps_create_tariff_table();
int  pps_add_charge_prefix(u_short iroot, char *prefix_digits, u_char len, u_short table_index);
int  pps_get_charge_prefix(u_char cosID,char *dialing_number);

#endif /* TARIFF__H */
