const mongoose = require('mongoose');

const posSchema = new mongoose.Schema({
    deviceId: String,
    distributionVersion: String,
    distributionVersionDownloaded: String,
    faretableTimestamp: Date,
    alarmStates: [{
        alarmState: String
    }],
    componentCounter: {
        smartCardReader: {
            ok: Number,
            err: Number
        },
        ticketPrinter: {
            ok: Number
        },
        documentScanner: {
            ok: Number,
            err: Number
        }
    },
    blockStatus: String,
    actionListVersion: String,
    transactionCounter: Number,
    securityElementId: String,
    securityElementTransactionCounter: Number,
    invoiceCounter: Number,
    invoiceDate: String,

    // device
    terminalId: Number,
    deviceSharedId: String,
    deviceVersion: String,
    locationExternalId: Number,
    location: String,
    locationTranslations: String,
    locationDescription: String,
    locationLongitude: Number,
    locationLatitude: Number,
    organization: String,
    organizationDescription: String,
    organizationExternalId: Number,

    // software
    appVersion: String,
    projectName: String,
    projectHomeUrl: String,
    developmentMode: Boolean,

    // modules
    hasTickets: Boolean,
    hasTicketGroups: Boolean,
    hasTicketLuggage: Boolean,
    hasProducts: Boolean,
    hasPenalties: Boolean,
    hasAccounts: Boolean,
    hasCardHolders: Boolean,
    hasReports: Boolean,
    hasPosUsers: Boolean,
    hasDriverCards: Boolean,
    hasSmartCards: Boolean,
    hasChangeRiderType: Boolean,
    hasSmartCardRecreate: Boolean,
    hasReservation: Boolean,
    hasSalesOrder: Boolean,

    // account modules
    hasAccountTopUp: Boolean,
    hasAccountTickets: Boolean,
    hasAccountTicketGroups: Boolean,
    hasAccountTicketLuggage: Boolean,
    hasAccountProducts: Boolean,
    hasAccountVerify: Boolean,
    hasAccountBlock: Boolean,
    hasAccountBlockDevice: Boolean,
    hasAccountManage: Boolean,
    hasAccountLink: Boolean,
    hasAccountPenalties: Boolean,
    hasAccountHistory: Boolean,
    hasAccountSmartcard: Boolean,

    // settings
    cashFloat: Boolean,
    virtualKeyboard: Boolean,
    autoLockMinutes: Number,
    minAutoLockMinutes: Number,
    maxAutoLockMinutes: Number,
    endOfWorkHour: String,
    employeeRoles: Object,
    employeeLanguage: String,
    firstLanguage: String,
    secondLanguage: String,
    minPassengers: Number,
    maxPassengers: Number,
    minNoOfPassengers: Number,
    maxNoOfPassengers: Number,
    maxTickets: Number,
    minNoOfTickets: Number,
    maxNoOfTickets: Number,
    phone: String,
    website: String,
    invoiceUpload: Boolean,
    hasDiscount: Boolean,
    transitTypeOrder: Object,
    utcOffset: String,
    displayName: String,
    bilingualPrint: Boolean,
    riderTypeIcon: Object,

    // currency
    currencyPrefix: Boolean,
    currencyCode: String,
    currencyDecimal: Number,
    showCurrencySymbol: Boolean,
    currencyDecimalSeparator: String,
    currencyThousandsSeparator: String,
    currencyConvertRate: Number,
    secondCurrencyCode: String,
    secondCurrencyDecimal: Number,
    showSecondCurrency: Boolean
});

const Pos = mongoose.model('Pos', posSchema);

module.exports = Pos;
