import { gql } from 'apollo-angular';

export const GET_STUDENTS = gql`
  query GetStudents {
    students {
      id
      name
      email
      totalCredits
      enrollments {
        id
        subjectId
        subjectName
        credits
        professorName
        enrolledAt
      }
    }
  }
`;

export const GET_STUDENT = gql`
  query GetStudent($id: Int!) {
    student(id: $id) {
      id
      name
      email
      totalCredits
      enrollments {
        id
        subjectId
        subjectName
        credits
        professorName
        enrolledAt
      }
    }
  }
`;

export const GET_AVAILABLE_SUBJECTS = gql`
  query GetAvailableSubjects($studentId: Int!) {
    availableSubjects(studentId: $studentId) {
      id
      name
      credits
      professorId
      professorName
      isAvailable
      unavailableReason
    }
  }
`;

export const GET_CLASSMATES = gql`
  query GetClassmates($studentId: Int!) {
    classmates(studentId: $studentId) {
      subjectId
      subjectName
      classmates {
        studentId
        name
      }
    }
  }
`;

export const GET_SUBJECTS = gql`
  query GetSubjects {
    subjects {
      id
      name
      credits
      professorId
    }
  }
`;
