(*
 * $Id$
 *
 * JSDAI(TM), a way to implement STEP, ISO 10303
 * Copyright (C) 1997-2008, LKSoftWare GmbH, Germany
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License
 * version 3 as published by the Free Software Foundation (AGPL v3).
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * JSDAI is a registered trademark of LKSoftWare GmbH, Germany
 * This software is also available under commercial licenses.
 * See also http://www.jsdai.net/
 *)

(*
 Derived from ISO TC184/SC4/WG12 N3118 - ISO/TS 10303-1267 Required resource - EXPRESS ARM
 by LKSoftWare GmbH for implementation purpose within IDA-STEP(TM)
*) 


SCHEMA Required_resource_xim;

USE FROM Classification_assignment_xim;    -- ISO/TS 10303-1114

USE FROM Resource_item_xim;    -- ISO/TS 10303-1268

USE FROM Value_with_unit_xim;    -- ISO/TS 10303-1054

USE FROM process_property_schema(
	action_resource_requirement,
	action_resource_requirement_relationship,
	requirement_for_action_resource,
	resource_requirement_type);

USE FROM action_schema(
	action_method);
	

TYPE required_resource_classification_item_armx = EXTENSIBLE GENERIC_ENTITY SELECT BASED_ON classification_item WITH 
   (Required_resource, 
    Required_resource_assignment, 
    Required_resource_relationship);
END_TYPE; 

TYPE required_resource_item = EXTENSIBLE GENERIC_ENTITY SELECT;
END_TYPE; 

ENTITY Required_resource
  ABSTRACT SUPERTYPE OF (ONEOF (Required_resource_by_resource_item,
                                Required_resource_by_specification))
  (* CONNOTATIONAL *) SUBTYPE OF (action_resource_requirement);
  (* Accessable from supertype
  name : STRING;
  description : OPTIONAL STRING; *)
  required_quantity : OPTIONAL measure_with_unit;
 (* this attribute is overlapping with entity mapping, so better not allow to set it on xim level *) 
 DERIVE
  SELF\action_resource_requirement.kind : resource_requirement_type := ?;
END_ENTITY;

ENTITY Required_resource_assignment
  (* CONNOTATIONAL *) SUBTYPE OF (action_method);
   assigned_resource : Required_resource;
   item : required_resource_item;
  DERIVE 
     SELF\action_method.name : label := 'resource management';
	 SELF\action_method.consequence : text :=  'required resource assignment';
	 SELF\action_method.purpose : text := 'standard action method';
  
END_ENTITY;

ENTITY Required_resource_by_resource_item
  (* CONNOTATIONAL *) SUBTYPE OF (Required_resource, requirement_for_action_resource);
  resource_item : Resource_item;
  DERIVE
   (* Overlaps with resource_item *)
   SELF\requirement_for_action_resource.resources : SET [1:?] OF action_resource :=?;
END_ENTITY;

ENTITY Required_resource_by_specification
  (* CONNOTATIONAL *) SUBTYPE OF (Required_resource); 
END_ENTITY;

ENTITY Required_resource_relationship
	(* CONNOTATIONAL *) SUBTYPE OF (action_resource_requirement_relationship);
	(* attributes are accessable from supertype
  name : STRING;
  description : OPTIONAL STRING; *)
  SELF\action_resource_requirement_relationship.relating_action_resource_requirement RENAMED relating : Required_resource;
  SELF\action_resource_requirement_relationship.related_action_resource_requirement RENAMED related : Required_resource;
END_ENTITY;

END_SCHEMA;  -- Required_resource_xim


