import { Post } from "@nestjs/common";

export const Constants = {
  salt_rounds: 10,
  cryptojs_key: 'thisiscryptojssecretkey',
  jwt_secret:
    'DO NOT USE THIS VALUE. INSTEAD, CREATE A COMPLEX SECRET AND KEEP IT SAFE OUTSIDE OF THE SOURCE CODE.',
  langueage: { en: 'English' },
  industries_list: 10,
  categories_list: 10,
  keywords_list: 10,
  brand_users_list: 10,
  browse_influencer_list: 12,
  file_manager_list: 10,
  error_log_list: 10,
  whatsapp_message_list: 10,
  faqs_list: 10,
  platform_charge: 10,
  RECOMMENDED_INFLUENCER: 100,
  AI_AGENT_REPORT_TOP_N: 100,
  SITEMAP_LIMIT: 10000,
  RECOMMENDED_CAMPAIGN: 12,
  RECOMMENDED_UPDATE_HOURS: 2,
  CAMPAIGN_INFLUENCER_STATUS_NOTIFICATION_REMINDER: 24,
  CAMPAIGN_POST_SYNC_CRON_DAYS: 1,
  CAMPAIGN_BRAND_STATUS_NOTIFICATION_REMINDER: 24,
  AI_PROMPT: {
    CAMPAIGN_BRIEFING: "Generate a Campaign Briefing: Analyze the provided data and determine the language of the campaign. If the budget currency is in HKD, generate the campaign briefing in Traditional Chinese (廣東話). If the budget currency is not HKD, then write the briefing in English. Structure the briefing to clearly present key details, including campaign objectives, target audience, influencer selection strategy, and expected outcomes. Ensure the content is well-organized, professional, and aligns with the data provided without adding unnecessary details.",
    FORMATTING: "Improve Clarity and Formatting: Take the existing campaign briefing and enhance its clarity, structure, and formatting to ensure it is professional, easy to read, and well-organized. Improve sentence flow, coherence, and readability while maintaining the original meaning and intent. Format the text appropriately to enhance its presentation and readability. Make the necessary improvements directly without adding extra comments or explanations.",
    POLITENESS_CHAT: "Enhance Politeness and Clarity: Refine the given message to improve its politeness, professionalism, and clarity while ensuring that the intended meaning remains unchanged. Adjust the tone to be more respectful and articulate, ensuring that the message is well-structured and effective in communication. Make the necessary modifications directly without adding extra comments or explanations. Remember to stick with the original language: if the message is in English, make sure to reply in English. If the message is in 廣東話/繁體中文, make sure to reply back in 廣東話/繁體中文. Never reply in 簡體中文 in such cases. DO NOT GIVE EMAIL FORMAT DATA, IF YOU NOT UNDERSTAND PROMPT MESSAGE THEN GIVE PROPER RESPONSE, HERE IS USER MESSAGE: ",
    MODEL: "gpt-5.6",
    AI_AGENT_REPORT: `You are a strict JSON scoring engine for influencer-campaign fit. Return exactly {{expectedCount}} influencer objects. Every ai_note MUST be short "• " bullet points separated by newlines — never a paragraph. Incomplete output is a hard failure.

You are an influencer marketing analyst for Connector Club. Score EACH applicant influencer for the given campaign using campaign details, brand objective/remark, categories, platforms, recommended scores, and influencer profile data. ai_score must be a number from 0 to 100. Prefer higher scores for better category/platform/geography fit, engagement, audience quality, brand collaboration history, and alignment with objective. Write report_summary, ai_note in Traditional Chinese (廣東話) when brand language is HK; otherwise use English.

STEP 1 — DERIVE CAMPAIGN CRITERIA (do this before scoring anyone):
Read INPUT_JSON's campaign_name, categories, and objective/remark. Identify 1-4 short, concrete criteria that capture the specific product/brand positioning implied by the campaign — not generic marketing terms.
Example: campaign_name "Lamborghini branded energy drink" blends two distinct themes, so criteria = ["luxury sport car", "energy drink"].
Example: campaign_name "Summer skincare routine for oily skin" implies criteria = ["skincare", "oily skin routine"].
Rules:
- 1 to 4 items. Prefer 2-3 unless the campaign clearly implies more distinct themes.
- Each criterion is a short noun phrase (2-4 words), not a sentence.
- Derive criteria ONLY from campaign_name, categories, and objective/remark already present in INPUT_JSON — never invent a brand, product, or theme not implied by that input.
- Keep every criterion label in ENGLISH even when brand language is HK, so the same string can be matched verbatim across all influencers. Only the notes get translated.
- Decide this list ONCE for the whole campaign and reuse the exact same strings, in the exact same order, for every influencer.
- Put the final list in the top-level "criteria" array of your response.

STEP 2 — SCORE EVERY INFLUENCER:
For each influencer, compute:
(a) an overall ai_score per the fit factors above (category/platform/geo, engagement, audience quality, collaboration history, objective alignment) — treat strong criteria fit from Step 1 as a positive input to ai_score and weak/no-evidence criteria fit as a negative input, but keep the original factors as the primary drivers;
(b) a criteria_scores entry for EACH criterion from Step 1, scoring 0-100 how well this specific influencer fits that specific criterion.

CRITICAL OUTPUT RULES (MUST FOLLOW EXACTLY — NON-NEGOTIABLE):
1. You MUST score EVERY influencer in INPUT_JSON.influencers.
2. EXPECTED influencer count = {{expectedCount}}.
3. response.influencers.length MUST equal {{expectedCount}}. No fewer, no more.
4. Do NOT skip, merge, summarize, sample, or return only top influencers.
5. Do NOT stop early. Incomplete lists are INVALID.
6. Keep every campaign_influencer_id and influencer_id EXACTLY as provided (copy IDs verbatim).
7. Every influencer's "criteria_scores" array MUST contain exactly one entry per item in the top-level "criteria" array, using the identical "criteria" string value, in the identical order.
8. Return ONLY valid JSON. No markdown fences, no extra text, no trailing commas.
9. Before finishing, verify: influencers.length == {{expectedCount}}, AND every influencer's criteria_scores.length == criteria.length.
10. ai_note MUST use bullet points with a real newline between each bullet. Encode those newlines as \\n inside the JSON string. NEVER write a paragraph or 2-sentence prose block.

AI_NOTE FORMAT RULES (MUST FOLLOW — DO NOT WRITE PARAGRAPHS):
1. ai_note MUST be 3 to 5 short bullet points. Each bullet starts with "• " and sits on its own line.
2. Separate bullets with a newline (\\n). Do NOT join bullets into one sentence or paragraph.
3. Each bullet is one short fact (about 6-14 words), evidence-based, from INPUT_JSON only.
4. Cover: match strength (strong / medium / weak), category/platform/geo, followers/engagement, and any missing data.
5. Do NOT invent followers, platforms, or categories.
6. Do NOT write prose like: "This Hong Kong Instagram meme account has 4,548 followers and 48.8493% reported engagement, supporting organic interaction..."
7. If data is missing, put that in its own bullet (e.g. "• No brand collaboration history provided").

GOOD ai_note (copy this shape, not the facts):
• Medium match — Entertainment & Pop Culture only
• No lifestyle, wellness, arts, or beauty category
• No collaboration history provided

BAD ai_note (never do this):
This Hong Kong Instagram meme account has 4,548 followers and 48.8493% reported engagement, supporting organic interaction despite a lower recommended_score of 117. The match is medium because Entertainment & Pop Culture is its only category...

FINAL CHECK: influencers.length MUST be {{expectedCount}}. Every influencer's criteria_scores.length MUST equal criteria.length, using the same criteria strings and order as the top-level "criteria" array. If either check fails, regenerate before returning.`
  },
  AI_AGENT_REPORT_JSON_SCHEMA: {
    type: 'object',
    properties: {
      report_summary: {
        type: 'string',
      },
      total_influencers_scored: {
        type: 'integer',
      },
      criteria: {
        type: 'array',
        items: {
          type: 'string',
        },
        minItems: 1,
        maxItems: 4,
      },
      influencers: {
        type: 'array',
        items: {
          type: 'object',
          properties: {
            campaign_influencer_id: {
              type: 'string',
            },
            ai_score: {
              type: 'number',
              minimum: 0,
              maximum: 100,
            },
            ai_note: {
              type: 'string',
            },
            criteria_scores: {
              type: 'array',
              items: {
                type: 'object',
                properties: {
                  criteria: {
                    type: 'string',
                  },
                  score: {
                    type: 'number',
                    minimum: 0,
                    maximum: 100,
                  },
                  estimated_reach_from: {
                    type: 'number',
                  },
                  estimated_reach_to: {
                    type: 'number',
                  },
                },
                required: [
                  'criteria',
                  'score',
                  'estimated_reach_from',
                  'estimated_reach_to',
                ],
                additionalProperties: false,
              },
            },
          },
          required: [
            'campaign_influencer_id',
            'ai_score',
            'ai_note',
            'criteria_scores',
          ],
          additionalProperties: false,
        },
      },
    },
    required: [
      'report_summary',
      'total_influencers_scored',
      'criteria',
      'influencers',
    ],
    additionalProperties: false,
  },
  COMET_CHAT_WEBHOOK_NOTIFICATION: 1,
  SOCIAL_MEDIA_CRON_DAY: 30,
  GUEST_PROFILE_ACCESS: {
    LIMIT: 100,
    DAYS: 2
  },
  POST_LIMIT: 12,
  TEST: 1,
  PERMISSIONS: [
    {
      "feature_name": "Browse Influencer",
      "description": "",
      "type": "browse_influencers",
      "limits": 0,
      "order_by": 1,
      "time_period": null,
    },
    {
      "feature_name": "Browse Influencer",
      "description": "",
      "type": "browse_influencers",
      "limits": 0,
      "order_by": 2,
      "time_period": "24",
    },
    {
      "feature_name": "Chat with Influencers",
      "description": "",
      "type": "chat_with_influencers",
      "limits": 0,
      "order_by": 3,
      "time_period": null,
    },
    {
      "feature_name": "Number of Open Campaigns",
      "description": "",
      "type": "number_of_campaigns",
      "limits": 0,
      "order_by": 4,
      "time_period": null,
    },
    {
      "feature_name": "Number of work order",
      "description": "",
      "type": "work_order",
      "limits": 0,
      "order_by": 5,
      "time_period": null,
    },
    {
      "feature_name": "Campaign Report",
      "description": "",
      "type": "campaign_report",
      "limits": 0,
      "order_by": 6,
      "time_period": null,
    },
    {
      "feature_name": "Export Influencer",
      "description": "",
      "type": "export_influencer_limit",
      "limits": 0,
      "order_by": 7,
      "time_period": null,
    },
    {
      "feature_name": "Export Influencer Time Limit",
      "description": "",
      "type": "export_influencer_time_limit",
      "limits": 0,
      "order_by": 8,
      "time_period": "2",
    }, {
      "feature_name": "Barter Allowed",
      "description": "",
      "type": "barter_allowed",
      "limits": 0,
      "order_by": 9,
      "time_period": null,
    },
    {
      "feature_name": "AI Agent Report",
      "description": "",
      "type": "ai_agent_report",
      "limits": 0,
      "order_by": 10,
      "time_period": null,
    }
  ],
  NOTIFICATION_TYPES: {
    closed: true,
    completion_request: true,
    draft_available: true,
    drafting_deliverables: true,
    posting_deliverables_brand: true,
    posting_deliverables_influencer: true,
    quotation_available: true,
    waiting_for_quotations: true,
    chase_up_waiting_for_quotations: true,
    chase_up_drafting_deliverables: true,
    chase_up_posting_deliverables: true,
    comet_chat_message: true,
  }
};  