text: /*
      Copyright (C) 2018 Google Inc.
      Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
  */
  
  import Cacheable from '../cacheable';
  import uniqueTitle from '../mixins/unique-title';
  import caUpdate from '../mixins/ca-update';
  import timeboxed from '../mixins/timeboxed';
  import accessControlList from '../mixins/access-control-list';
  import scopeObjectNotifications from '../mixins/scope-object-notifications';
  import questionnaire from '../mixins/questionnaire';
  import Stub from '../stub';
  
  export default Cacheable('CMS.Models.Vendor', {
    root_object: 'vendor',
    root_collection: 'vendors',
    category: 'business',
    findAll: 'GET /api/vendors',
    findOne: 'GET /api/vendors/{id}',
    create: 'POST /api/vendors',
    update: 'PUT /api/vendors/{id}',
    destroy: 'DELETE /api/vendors/{id}',
    mixins: [
      uniqueTitle,
      caUpdate,
      timeboxed,
      accessControlList,
      scopeObjectNotifications,
      questionnaire,
    ],
    is_custom_attributable: true,
    isRoleable: true,
    attributes: {
      context: Stub,
      modified_by: Stub,
    },
    tree_view_options: {
      attr_view: GGRC.mustache_path + '/base_objects/tree-item-attr.mustache',
      attr_list: Cacheable.attr_list.concat([
        {attr_title: 'Reference URL', attr_name: 'reference_url'},
        {attr_title: 'Effective Date', attr_name: 'start_date'},
        {attr_title: 'Last Deprecated Date', attr_name: 'end_date'},
        {
          attr_title: 'Launch Status',
          attr_name: 'status',
          order: 40,
        }, {
          attr_title: 'Description',
          attr_name: 'description',
          disable_sorting: true,
        }, {
          attr_title: 'Notes',
          attr_name: 'notes',
          disable_sorting: true,
        }, {
          attr_title: 'Assessment Procedure',
          attr_name: 'test_plan',
          disable_sorting: true,
        },
      ]),
      add_item_view:
        GGRC.mustache_path + '/base_objects/tree_add_item.mustache',
    },
    sub_tree_view_options: {
      default_filter: ['Program'],
    },
    links_to: {
      System: {},
      Process: {},
      Program: {},
      Product: {},
      Facility: {},
      OrgGroup: {},
      Vendor: {},
      Project: {},
      DataAsset: {},
      AccessGroup: {},
      Market: {},
    },
    defaults: {
      status: 'Draft',
    },
    statuses: ['Draft', 'Deprecated', 'Active'],
    init: function () {
      if (this._super) {
        this._super(...arguments);
      }
  
      this.validateNonBlank('title');
    },
  }, {});
  