'use strict';

var angular = require('angular');

require('../modules');

var module = angular.module('archivesincept.services');

/*
 * 收文单权限判断service
*/
module.factory('ArchivesInceptAuthService', function() {

  function ArchivesInceptAuthService(xzyz){
    this.archivesincept = xzyz.archivesincept;
  }

 /**
   * 字段说明：
   * 草稿：xiugai=0
   * 流程中：xiugai=1
   * 流程结束：xiugai=2
   * 撤办：xiugai=5
   * xiugai的值选择范围（0、1、2、5）
   */
  ArchivesInceptAuthService.prototype = {

    /**
     * 文秘可以签收
     * @return {[type]} [description]
     */
    signin: function(){
      return this.archivesincept.flag === '1';
    },

    returnback: function () {
      return this.archivesincept.flag === '2' || this.archivesincept.flag === '1';
    },

    wanbi: function () {
      return this.archivesincept.flag === '2';
    }

  };

  return ArchivesInceptAuthService;
});

