Files
ppc_amnet/amnet-native/models/AMPhysicalCardData.ts
2025-04-02 19:27:24 +01:00

28 lines
847 B
TypeScript

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<AMPhysicalCardData> {
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}
}
};
}