i don’t know if i can put here the code coded by chatgpt but i just copy and paste what you asked (everthing) and it did a full code, maybe can help you, i hope.
Please dont tell others to use ChatGPT, or provide code written by ChatGPT. It can be wildly inaccurate, and unless you are going through the code to make sure its right then you could potentially be causing more issues to someone’s code