//
// CreditCard.h
// GotoBus
//
// Created by haibara on 2/11/15.
//
//

#import <Foundation/Foundation.h>
#import "Address.h"
#import <CardIO.h>

@interface CreditCard : NSObject <NSCopying>

@property (nonatomic, assign) NSInteger ccid;
@property (nonatomic, strong) NSString *name_on_card;
@property (nonatomic, assign) NSInteger card_type;
@property (nonatomic, strong) NSString *card_number;
@property (nonatomic, strong) NSString *x_card_code;
@property (nonatomic, strong) NSString *expire_month;
@property (nonatomic, strong) NSString *expire_year;

@property (nonatomic, strong) Address *address;

@property (nonatomic, assign) BOOL isDefault;
@property (nonatomic, assign) BOOL transient;

@property (nonatomic, assign, readwrite) BOOL persistent;
@property (nonatomic, assign, readwrite) CardIOCreditCardType creditCardType;
@property (nonatomic, strong, readonly) NSString *cardTypeName;
@property (nonatomic, strong, readonly) UIImage *cardTypeImage;

- (void)setValuesForKeysWithCreditCardInfo:(CardIOCreditCardInfo *)cardInfo;
- (NSAttributedString *)attributedRedactedCardNumberIfDefaultAppendingWithFormat:(NSString *)format;

- (NSString *)innerXML;

+ (CreditCard *)primaryOfCreditCards:(NSArray *)creditCards;
+ (CreditCard *)defaultOfCreditCards:(NSArray *)creditCards;
+ (CreditCard *)randomCreditCard;

@end
