export const PRODUCT_NAME = "MikrotikManager"
export const LEGACY_PRODUCT_NAME = "RouterLists"

export function hasManagedCommentPrefix(comment: string): boolean {
  const value = comment.trim()
  return value.startsWith(`${PRODUCT_NAME}:`) || value.startsWith(`${LEGACY_PRODUCT_NAME}:`)
}

export function hasManagedRecursiveComment(comment: string): boolean {
  const value = comment.trim()
  return (
    value.startsWith(`${PRODUCT_NAME}:recursive`) ||
    value.startsWith(`${LEGACY_PRODUCT_NAME}:recursive`)
  )
}

export function managedComment(label: string): string {
  return `${PRODUCT_NAME}: ${label}`
}

export function managedRecursiveComment(comment?: string | null): string {
  return comment ? `${PRODUCT_NAME}:recursive ${comment}` : `${PRODUCT_NAME}:recursive`
}
