#include "head.h"

int main(void){
    setlocale(LC_ALL, "");
    struct structStudentList{
        wchar_t _name[MAXSYMB_IN_NAME+1];
        wchar_t _surname[MAXSYMB_IN_SURNAME+1];
        char age;
        char curse;
    };

    struct structStudentList students[MAXSTUDENTS+1];
    
    char count_acc[MAXSTUDENTS+1];
    {
        for (int i = 0; i<MAXSTUDENTS;i++)
            count_acc[i] = i;
    }

    {
        wchar_t _currrow[MAXSYMB_IN_CURROW+1];
        char flag = 0;
        do{ // Main Menu
            clear;
            print_menu_main();
            flag = get_num();
            char sw = 0;
            char status;
            switch(flag){
                case 1:
                    { // Crete acc
                        if(count_acc[MAXSTUDENTS]==0){
                            print_no_free_space();
                        }
                        else{
                            print_menu_create(*count_acc);
                            
                        }
                        break;
                    }
                case 2:
                    { // Edit acc
                        print_wich_student();
                        
                        sw = get_num();
                        if(sw==-1)return 0;
                        
                        status = 0;
                        
                        for(int i = 0;i<MAXSTUDENTS;i++){
                            status = sw == count_acc[i]?1:0;
                            if(status) break;
                        }
    
                        if(status){
                            print_acc_not_exist();
                        }
                        else{
    
                        }
                        break;
                    }
                case 3:
                    { // Del acc
                        print_wich_student();
                        sw = get_num();
                        if(sw==-1)return 0;
                        
                        status = 0;
                        for(int i = 0;i<MAXSTUDENTS;i++){
                            status = sw == count_acc[i]?1:0;
                            if(status) break;
                        }
    
                        if(status){
                            print_acc_not_exist();
                        }
                        else{
                            del_acc(sw);
                        }
                        break;
                    }
                case 4:
                    break;
                default:
                    return 0;
            }       
        }while(flag);
    }

    return 0;
}
