/**
 * Policy Mappings
 * (sails.config.policies)
 *
 * Policies are simple functions which run **before** your actions.
 *
 * For more information on configuring policies, check out:
 * https://sailsjs.com/docs/concepts/policies
 */

module.exports.policies = {

  /***************************************************************************
  *                                                                          *
  * Default policy for all controllers and actions, unless overridden.       *
  * (`true` allows public access)                                            *
  *                                                                          *
  ***************************************************************************/

  // '*': true,
  // 'socket/createdemande': true,
  //'socket/subscribe': true,
  ///'abonnement/create': true,
  'auth/login': true,
  'auth/login-mobile': true,
  'auth/verify-user': true,
  'auth/verify-codeverif': true,
  'auth/login-with-codeverif': true,

  'auth/verify-user-mobil': true,
  'auth/verify-codeverif-mobil': true,
  'auth/login-with-codeverif-mobil': true,
  'auth/forgot-password': true,
  'auth/reset-password-request': true,

  'annee-scolaire/create-logi': true,
  'attribution-classe/create-logi': true,
  'attribution-classe/create-logi-multi': true,
  'attribution-matiere/create-logi-multi': true,
  'attribution-note-moyenne/create-logi-multi': true,
  'attribution-rang/create-logi-multi': true,
  'details-payement/create-logi-multi': true,
  'details-payement-facultatif/create-logi-multi': true,
  'eleves/create-logi-multi': true,
  'emplois-temps/create-logi-multi': true,
  'enseignants/create-logi-multi': true,
  'filiation/create-logi-multi': true,
  'parents/create-logi-multi': true,
  'quittances/create-logi-multi': true,
  'quittances-facultatif/create-logi-multi': true,
  'scolarite/create-logi-multi': true,
  'utilisateur/create-logi-multi': true,
  'ordre-evaluation/create-logi-multi': true,
  'enseignants/create-logi-classe-ens-multi': true,
  'attribution-matiere/create-logi': true,
  'attribution-matiere-eleve/create-logi': true,
  'attribution-note-moyenne/create-logi': true,
  'attribution-rang/create-logi': true,
  'attribution-sys-sco/create-logi': true,
  'classe/create-logi': true,
  'details-payement/create-logi': true,
  'details-payement-facultatif/create-logi': true,
  'ecoles/create-logi': true,
  'eleves/create-logi': true,
  'filiation/create-logi': true,
  'ordre-evaluation/create-logi': true,
  'parents/create-logi': true,
  'quittances/create-logi': true,
  'quittances-facultatif/create-logi': true,
  'scolarite/create-logi': true,
  'utilisateur/create-logi': true,
  'nature-recette/create-logi': true,
  'nature-recette/create-logi-multi': true,
  'enseignants/create-logi': true,
  'enseignants/create-logi-classe-ens': true,
  'prof-notes/logi-note-oui': true,
  'classe/create-logi-multi': true,
  'auth/forgot-password-mobile': true,
  'auth/verify-reset-code-mobile': true,
  'auth/reset-password-mobile': true,

  // Public read endpoints for app bootstrap (with rate limiting)
  'app/config': 'rateLimit',
  'schools/resolve': 'rateLimit',

  'fedapay/return': true,
  'fedapay/webhook': true,
  
  'emplois-temps/create-logi': true,
  'prof-notes/logi-find-codmoy': true,
  'prof-notes/logi-findone-note': true,
  'prof-notes/logi-note-det-oui': true,
  'prof-notes/logi-count-notes': true,

  'primaire/logi-creat-moyenne-multi': true,
  'primaire/logi-create-evaluation-multi': true,
  'primaire/logi-create-indice-calcul-multi': true,
  'primaire/logi-create-matiere-classe': true,
  'primaire/logi-create-matiere-multi': true,
  'primaire/logi-create-note-det-multi': true,
  'primaire/logi-create-note-multi': true,
  'primaire/logi-create-unite-scolaire-multi': true,
  'primaire/logi-create-seuil': true,
  'primaire/test-data': true,

  'ecoles/find': 'isAdmin',
  'ecoles/create': 'isAdmin',
  'ecoles/update': 'isAdmin',
  'ecoles/delete': 'isAdmin',

  'annee-scolaire/create': 'isAdmin',
  'annee-scolaire/update': 'isAdmin',
  'annee-scolaire/delete': 'isAdmin',

  //'classe/find':['isAdmin', 'isAdministration'],

  'parents/find': 'isAdmin',
  //'parents/find': 'isAdministration',

  //'utilisateur/find': 'isAdmin',

  'parents/eleves-parent': 'isParent',


  '*': ['isAuthorized'],
  //'demande/create': 'isClient',
  //'user/check': true

};
