import {Realm} from "realm"; import {AmusementICVendor, ICType} from "../lib/iccard"; /** * Holds physical card information when a card is imported via NFC/FeliCa */ export class AMPhysicalCardData extends Realm.Object { cardIDm: string; cardType: ICType; cardVendor: AmusementICVendor | null; get isBootlegAmusementCard() { // real cards have an IDm manufacturer code of 012E (first two bytes of the IDm or in this case, the first 4 characters) return this.cardType === ICType.Amusement && !this.cardIDm.startsWith("012E"); } static schema: Realm.ObjectSchema = { name: "physicalCard", primaryKey: "cardIDm", properties: { cardIDm: "string", cardType: "int", cardVendor: {type: "int", optional: true} } }; }