// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0
import { DEFAULT_TENANT_ID, IMessageContext } from '@citrineos/base';
import { faker } from '@faker-js/faker';
import { applyUpdateFunction, UpdateFunction } from '../utils/UpdateUtil.js';

export const aMessageContext = (
  updateFunction?: UpdateFunction<IMessageContext>,
): IMessageContext => {
  const item: IMessageContext = {
    correlationId: faker.string.uuid(),
    tenantId: DEFAULT_TENANT_ID,
    ocppConnectionName: faker.string.uuid(),
    timestamp: faker.date.recent().toISOString(),
  };

  return applyUpdateFunction(item, updateFunction);
};
