text: import React, { Component } from 'react';
  import PropTypes from 'prop-types';
  import { Route, withRouter } from 'react-router-dom';
  import { compose } from 'ramda';
  import { createFragmentContainer } from 'react-relay';
  import graphql from 'babel-plugin-relay/macro';
  import { withStyles } from '@material-ui/core/styles';
  import inject18n from '../../../../components/i18n';
  import EntityStixCoreRelationships from '../../common/stix_core_relationships/EntityStixCoreRelationships';
  import StixCoreRelationship from '../../common/stix_core_relationships/StixCoreRelationship';
  import ThreatActorPopover from './ThreatActorPopover';
  import StixDomainObjectHeader from '../../common/stix_domain_objects/StixDomainObjectHeader';
  import StixDomainObjectAttackPatterns from '../../common/stix_domain_objects/StixDomainObjectAttackPatterns';
  import StixDomainObjectThreatKnowledge from '../../common/stix_domain_objects/StixDomainObjectThreatKnowledge';
  import StixDomainObjectVictimology from '../../common/stix_domain_objects/StixDomainObjectVictimology';
  import StixCoreObjectStixCyberObservables from '../../observations/stix_cyber_observables/StixCoreObjectStixCyberObservables';
  import EntityStixSightingRelationships from '../../events/stix_sighting_relationships/EntityStixSightingRelationships';
  
  const styles = () => ({
    container: {
      margin: 0,
      padding: '0 200px 0 0',
    },
  });
  
  class ThreatActorKnowledgeComponent extends Component {
    render() {
      const { classes, threatActor } = this.props;
      const link = `/dashboard/threats/threat_actors/${threatActor.id}/knowledge`;
      return (
        <div className={classes.container}>
          <StixDomainObjectHeader
            stixDomainObject={threatActor}
            PopoverComponent={<ThreatActorPopover />}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/relations/:relationId"
            render={(routeProps) => (
              <StixCoreRelationship
                entityId={threatActor.id}
                paddingRight={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/overview"
            render={(routeProps) => (
              <StixDomainObjectThreatKnowledge
                stixDomainObjectId={threatActor.id}
                stixDomainObjectType="Threat-Actor"
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/related"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['related-to', 'part-of']}
                targetStixDomainObjectTypes={['Stix-Domain-Object']}
                entityLink={link}
                allDirections={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/victimology"
            render={(routeProps) => (
              <StixDomainObjectVictimology
                stixDomainObjectId={threatActor.id}
                entityLink={link}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/threat_actors"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['part-of']}
                targetStixDomainObjectTypes={['Threat-Actor']}
                entityLink={link}
                allDirections={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/intrusion_sets"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['attributed-to']}
                targetStixDomainObjectTypes={['Intrusion-Set']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/campaigns"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['attributed-to']}
                targetStixDomainObjectTypes={['Campaign']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/attack_patterns"
            render={(routeProps) => (
              <StixDomainObjectAttackPatterns
                stixDomainObjectId={threatActor.id}
                entityLink={link}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/malwares"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['uses']}
                targetStixDomainObjectTypes={['Malware']}
                entityLink={link}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/tools"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['uses']}
                targetStixDomainObjectTypes={['Tool']}
                entityLink={link}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/vulnerabilities"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['targets']}
                targetStixDomainObjectTypes={['Vulnerability']}
                entityLink={link}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/incidents"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['attributed-to']}
                targetStixDomainObjectTypes={['Incident']}
                entityLink={link}
                isRelationReversed={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/observables"
            render={(routeProps) => (
              <StixCoreObjectStixCyberObservables
                stixCoreObjectId={threatActor.id}
                stixCoreObjectLink={link}
                noRightBar={true}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/infrastructures"
            render={(routeProps) => (
              <EntityStixCoreRelationships
                entityId={threatActor.id}
                relationshipTypes={['uses', 'compromises']}
                targetStixDomainObjectTypes={['Infrastructure']}
                entityLink={link}
                isRelationReversed={false}
                {...routeProps}
              />
            )}
          />
          <Route
            exact
            path="/dashboard/threats/threat_actors/:threatActorId/knowledge/sightings"
            render={(routeProps) => (
              <EntityStixSightingRelationships
                entityId={threatActor.id}
                entityLink={link}
                noRightBar={true}
                targetStixDomainObjectTypes={[
                  'Region',
                  'Country',
                  'City',
                  'Position',
                  'Sector',
                  'Organization',
                  'Individual',
                ]}
                {...routeProps}
              />
            )}
          />
        </div>
      );
    }
  }
  
  ThreatActorKnowledgeComponent.propTypes = {
    threatActor: PropTypes.object,
    classes: PropTypes.object,
    t: PropTypes.func,
  };
  
  const ThreatActorKnowledge = createFragmentContainer(
    ThreatActorKnowledgeComponent,
    {
      threatActor: graphql`
        fragment ThreatActorKnowledge_threatActor on ThreatActor {
          id
          name
          aliases
        }
      `,
    },
  );
  
  export default compose(
    inject18n,
    withRouter,
    withStyles(styles),
  )(ThreatActorKnowledge);
  