import { factory } from 'factory-bot' import { datatype, date, internet, random } from 'faker' import { sample } from 'lodash' import { BioimpedanceCredit, Campaign, CreditPending, TeleconsultationsCredit } from '../../src/models/credits' import { Products } from '../../src/models/enums/products.enum' factory.define( 'bioimpedance_credit', BioimpedanceCredit, { id: datatype.uuid, reason: () => 'other', created_at: date.recent, created_by_id: datatype.uuid, created_by_type: () => sample(['user', 'patient']), patient_id: datatype.uuid, value: () => 1, }, BioimpedanceCredit, ) factory.define( 'teleconsultations_credit', TeleconsultationsCredit, { id: datatype.uuid, reason: () => 'other', created_at: date.recent, created_by_id: datatype.uuid, created_by_type: () => sample(['user', 'patient']), patient_id: datatype.uuid, credit_id: datatype.uuid, value: () => 1, }, TeleconsultationsCredit, ) factory.define( 'credit_pending', CreditPending, { id: datatype.uuid, reason: () => 'other', created_at: date.recent, created_by_id: datatype.uuid, created_by_type: () => sample(['user', 'patient']), patient_id: datatype.uuid, value: () => 1, document_number: datatype.hexaDecimal, email: internet.email, product: () => sample(Object.values(Products)), }, CreditPending, ) factory.define( 'campaign', Campaign, { value: datatype.uuid, description: random.word, product: () => sample(Object.values(Products)), credit_quantity: () => datatype.number({ min: 1, max: 10 }), total_available: () => datatype.number({ min: 1, max: 10 }), total_used: () => datatype.number({ min: 1, max: 10 }), }, Campaign, ) export { factory }