#!/usr/bin/env python

import os
import sys

prompt_template = '''
# {plural} / {single}

Hi, using information from

- @schema.dbml for schemas, fields and table names,
- @listHelloworld.ts for skeleton for ts script
- @listVocabularies.ts, @listUserMetas.ts, @listQuizListening.ts, @listQuisMatching.ts, @listQuizConnectivesCategories for reference

extend @list{plural}.ts to cover `{plural}`,
draft `ts` code

- `CRUD`
- `getFulllist{plural},`
- `getListByFilter{plural},`
- `getFirstListItem{plural},`
- `getOne{single},`
- `getList{single}ById`

thanks
'''

def generate_prompt(plural, single):
    return prompt_template.format(
        plural=plural,
        single=single,
    )
table_list = [
  ('LessonCategories', 'LessonCategory'),
  ('LessonTypes', 'LessonType'),
  ('QuizCategories', 'QuizCategory'),
  ('QuizConnectives', 'QuizConnective'),
  ('QuizConnectivesCategories', 'QuizConnectivesCategory'),
  ('QuizListenings', 'QuizListening'),
  ('QuizMatchings', 'QuizMatching'),
  ('UserMetas', 'UserMeta'),
  ('Users', 'User'),
  ('Vocabularies', 'Vocabulary'),
]

for (plural, single) in table_list:
    prompt = generate_prompt(plural, single)
    print(prompt)

    with open(f"./PROMPT_{plural}.MD", "w+") as f:
        f.write(prompt)
