"use strict";
function getBooleanStatus(val) {
  if (process.env.NODE_ENV === "production") {
    return `PiiFree:${!!val}`;
  } else {
    return val;
  }
}
function getPiiFreeCalendarEvent(calEvent) {
  return {
    eventTypeId: calEvent.eventTypeId,
    type: calEvent.type,
    startTime: calEvent.startTime,
    endTime: calEvent.endTime,
    schedulingType: calEvent.schedulingType,
    seatsPerTimeSlot: calEvent.seatsPerTimeSlot,
    appsStatus: calEvent.appsStatus,
    recurringEvent: calEvent.recurringEvent,
    recurrence: calEvent.recurrence,
    requiresConfirmation: calEvent.requiresConfirmation,
    uid: calEvent.uid,
    conferenceCredentialId: calEvent.conferenceCredentialId,
    iCalUID: calEvent.iCalUID,
    /**
     * Let's just get a boolean value for PII sensitive fields so that we atleast know if it's present or not
     */
    // Not okay to have title which can have Booker and Organizer names
    title: getBooleanStatus(calEvent.title)
    // .... Add all other props here that we don't want to be logged. It prevents those properties from being logged accidentally
  };
}
function getPiiFreeBooking(booking) {
  return {
    id: booking.id,
    uid: booking.uid,
    userId: booking.userId,
    startTime: booking.startTime,
    endTime: booking.endTime,
    /**
     * Let's just get a boolean value for PII sensitive fields so that we atleast know if it's present or not
     */
    // Not okay to have title which can have Booker and Organizer names
    title: getBooleanStatus(booking.title)
    // .... Add all other props here that we don't want to be logged. It prevents those properties from being logged accidentally
  };
}
function getPiiFreeCredential(credential) {
  const booleanKeyStatus = getBooleanStatus(credential?.key);
  return {
    ...credential,
    key: booleanKeyStatus,
    delegatedTo: !!credential.delegatedTo
  };
}
function getPiiFreeSelectedCalendar(selectedCalendar) {
  return {
    integration: selectedCalendar.integration,
    userId: selectedCalendar.userId,
    // Get first 3 characters of externalId, so that we know what it could be but not the full value
    externalId: selectedCalendar.externalId?.slice(0, 3),
    credentialId: !!selectedCalendar.credentialId
  };
}
function getPiiFreeDestinationCalendar(destinationCalendar) {
  return {
    integration: destinationCalendar.integration,
    userId: destinationCalendar.userId,
    credentialId: destinationCalendar.credentialId,
    /**
     * Let's just get a boolean value for PII sensitive fields so that we atleast know if it's present or not
     */
    externalId: getBooleanStatus(destinationCalendar.externalId)
  };
}
function getPiiFreeEventType(eventType) {
  return {
    id: eventType.id,
    schedulingType: eventType.schedulingType,
    seatsPerTimeSlot: eventType.seatsPerTimeSlot
  };
}
function getPiiFreeUser(user) {
  return {
    id: user.id,
    username: user.username,
    isFixed: user.isFixed,
    timeZone: user.timeZone,
    allowDynamicBooking: user.allowDynamicBooking,
    defaultScheduleId: user.defaultScheduleId,
    organizationId: user.organizationId,
    credentials: user.credentials?.map(getPiiFreeCredential),
    destinationCalendar: user.destinationCalendar ? getPiiFreeDestinationCalendar(user.destinationCalendar) : user.destinationCalendar
  };
}
exports.getPiiFreeBooking = getPiiFreeBooking;
exports.getPiiFreeCalendarEvent = getPiiFreeCalendarEvent;
exports.getPiiFreeCredential = getPiiFreeCredential;
exports.getPiiFreeDestinationCalendar = getPiiFreeDestinationCalendar;
exports.getPiiFreeEventType = getPiiFreeEventType;
exports.getPiiFreeSelectedCalendar = getPiiFreeSelectedCalendar;
exports.getPiiFreeUser = getPiiFreeUser;
