import { Language } from './tags';

export type PublicUser = {
    id: number;
    login?: string;
    name?: string;
    surname?: string;
    faceImageUrl?: string;
};

// type User = {
//     "id": 0,
//     "login": "string",
//     "password": "string",
//     "role": "coach",
//     "name": "string",
//     "surname": "string",
//     "phone": "string",
//     "faceImageId": 0,
//     "createdAtUtc": "2024-05-15T14:26:19.310Z",
//     "practiceHours": 0,
//     "supervisionPerYearId": 0,
//     "sessionDuration": 0,
//     "sessionCost": 0,
//     "adminRoles": "admin",
//     "isCoachApproved": true,
//     "isBanned": true,
//     "faceImage": {
//         "id": 0,
//         "userId": 0,
//         "descriptor": "string",
//         "fileType": "string",
//         "contentLength": 0,
//         "state": "active",
//         "createdAtUtc": "2024-05-15T14:26:19.310Z",
//         "unusedSinceUtc": "2024-05-15T14:26:19.310Z"
//     },
//     "coachRating": 0,
//     "isTestMode": true,
//     "beneficiaryName": "string",
//     "beneficiaryIban": "string",
//     "beneficiaryBicOrSwift": "string",
//     "userThemesTags": [
//         {
//             "userId": 0,
//             "themesTagId": 0,
//             "themesTag": {
//                 "id": 0,
//                 "groupId": 0,
//                 "name": "string",
//                 "isActive": true,
//                 "userId": 0,
//                 "group": {
//                     "id": 0,
//                     "name": "string",
//                     "isActive": true,
//                     "userId": 0,
//                     "tags": [
//                         "string"
//                     ],
//                     "multilangs": [
//                         {
//                             "parentId": 0,
//                             "languageCode": "string",
//                             "name": "string"
//                         }
//                     ]
//                 },
//                 "userThemesTags": [
//                     "string"
//                 ],
//                 "multilangs": [
//                     {
//                         "parentId": 0,
//                         "languageCode": "string",
//                         "name": "string"
//                     }
//                 ]
//             },
//             "user": "string"
//         }
//     ],
//     "languagesLinks": [
//         {
//             "userId": 0,
//             "languageId": 0,
//             "user": "string",
//             "language": Language
//         }
//     ]
// };

export enum SessionState {
    CREATED = 'created',
    PAID = 'paid',
    COACH_APPROVED = 'coachApproved',
    STARTED = 'started',
    FINISHED = 'finished',
    COACH_DECLINED = 'coachDeclined',
    CLIENT_CANCELED = 'clientCanceled',
    COACH_CANCELED = 'coachCanceled'
}

type SessionTag = {
    id: number;
    groupId?: number;
    name?: string;
    isActive?: boolean;
    isSelected?: boolean;
    canDeleted?: boolean;
};

export type SessionsFilter = {
    tags?: (number | string)[];
    startDate?: string;
    endDate?: string;
};

export type SessionComment = {
    id: number;
    createdAtUtc: string;
    comment: string;
    author?: PublicUser;
    authorId?: number;
    sessionId?: number;
};

export type Session = {
    id: number;
    scheduledStartAtUtc?: string;
    scheduledEndAtUtc?: string;
    state?: SessionState;
    clientComment?: string;
    secret?: string;
    cost?: number;
    themesTagName?: string;
    totalDuration?: number;
    type?: string;
    maxClients: number;
    title?: string;
    description?: string;
    isNeedSupervisor?: boolean;
    supervisorComment?: string;
    user?: PublicUser;
    coach?: PublicUser;
    supervisor?: PublicUser;
    clients?: PublicUser[];
    themesTags?: SessionTag[];
    coachComments?: SessionComment[];
    clientComments?: SessionComment[];
};

export enum SessionType {
    UPCOMING = 'upcoming',
    REQUESTED = 'requested',
    RECENT = 'recent'
}

export type Sessions = {
    [SessionType.UPCOMING]?: Session[];
    [SessionType.REQUESTED]?: Session[];
    [SessionType.RECENT]?: Session[];
};

export type DeclineSessionData = {
    sessionId: number;
    reason: string;
};

export type SessionCommentData = {
    createdAtUtc: string;
    comment: string;
    sessionId: number;
}
