// types
import {Models} from "appwrite";

export type SignWithEmailUpProps = {
    firstName: string;
    lastName: string;
    email: string;
    password: string;
    userType: UserType;
}

export type SignUpReturnStatus = {
    message: string;
    code: number;
    error?: string | null;
    type?: string | null;
}
// types
export type LoginWithEmailProps = {
    email: string;
    password: string;
}
export type LoginReturnStatus = {
    message: string;
    code: number;
    error?: string | null;
}


// type
export type AppriteActionReturnStatus = {
    message: string;
    code: number;
    error?: string | null;
}


export enum UserType {
    ADMIN = "admin",
    CLIENT = "client",
    PATIENT = "patient"
}

export interface UserProfile extends Models.Document {
    userId: string;
    userType: UserType;
    fullName: string;

    about?: string;
    avatarId: string | null;
    avatarUrl: string | null;
    status?: "Online" | "Offline" | "Unavailable";
    lastSeenOnlineAt?: string;
    online?: boolean;
    sessions?: Session[];

    changeLog?: string;
    changerId?: string;
}


export interface PatientProfile extends Models.Document {
    userId: string;
    firstName: string;
    lastName: string;
    age?: string | null;
    gender?: string | null;
    location?: string | null;
    employmentStatus?: string | null;
    relationshipStatus?: string | null;
    preferredLanguage?: string | null;
    currentMedication?: string | null;
    medicalConditions?: string | null;
    changeLog?: string;
    changerId: string;
}


// client types

export interface ClientProfile extends Models.Document {
    userId: string;
    title: string;
    firstName: string;
    lastName: string;
    email: string;
    phoneNumber: string;
    emergencyContact?: string | null;
    physicalAddress: string | null;
    dob: Date;
    specializedSkills: string[],
    languages: string[],
    nursingLicenceNumber: string;
    qualificationEarned: string;
    nursingSchool: string;
    graduationDate: Date;
    changeLog?: string;
    changerId: string;
}


declare type AppointmentStatus = "pending" | "scheduled" | "cancelled";

export interface Appointment extends Models.Document {
    patient: Patient;
    schedule: Date;
    status: AppointmentStatus;
    primaryPhysician: string;
    reason: string;
    note: string;
    userId: string;
    cancellationReason: string | null;
    changeLog?: string;
    changerId: string;
}


// sessions

export interface Session extends Models.Document {
    sessionMessages: SessionMessage[];
    participants: any;
    changeLog?: string;
    changerId: string;
}

export interface SessionMessage extends Models.Document {
    session: string;
    senderId: string;
    recipientId: string;
    message: string;
    read: boolean;
    editedAt: string | null;
}