# frozen_string_literal: true

class CreditSerializer < ApplicationSerializer
  set_type :credit

  attribute :course_id
  attribute :course_name
  attribute :status
  attribute :course_type, &:course_type_string
  attribute :assigned_count

  has_many :credit_assignments, if: proc { |_record, params| params && params[:include_relations] == true }
  has_many :enrollments, if: proc { |_record, params| params && params[:include_relations] == true }
  has_many :contracts, if: proc { |_record, params| params && params[:include_relations] == true }
  has_many :users, if: proc { |_record, params| params && params[:include_relations] == true }
end
