# GENERATED BY KOMAND SDK - DO NOT EDIT
import komand
import json


class Component:
    DESCRIPTION = "Import observable(s) into Anomali ThreatStream with approval"


class Input:
    FILE = "file"
    OBSERVABLE_SETTINGS = "observable_settings"
    

class Output:
    RESULTS = "results"
    

class ImportObservableInput(komand.Input):
    schema = json.loads("""
   {
  "type": "object",
  "title": "Variables",
  "properties": {
    "file": {
      "$ref": "#/definitions/file",
      "title": "File",
      "description": "File of data to be imported into Anomali ThreatStream",
      "order": 1
    },
    "observable_settings": {
      "$ref": "#/definitions/observable_settings",
      "title": "Observable Settings",
      "description": "Settings needed for importing an observable that needs approval",
      "order": 2
    }
  },
  "required": [
    "file"
  ],
  "definitions": {
    "file": {
      "id": "file",
      "type": "object",
      "title": "File",
      "description": "File Object",
      "properties": {
        "content": {
          "type": "string",
          "title": "Content",
          "description": "File contents",
          "format": "bytes"
        },
        "filename": {
          "type": "string",
          "title": "Filename",
          "description": "Name of file"
        }
      }
    },
    "observable_settings": {
      "type": "object",
      "title": "observable_settings",
      "properties": {
        "classification": {
          "type": "string",
          "title": "Classification",
          "description": "Classification of the observable",
          "default": "private",
          "enum": [
            "public",
            "private"
          ],
          "order": 4
        },
        "confidence": {
          "type": "integer",
          "title": "Confidence",
          "description": "Confidence value assigned to the observable. Confidence score can range from 0-100, in increasing order of confidence",
          "order": 1
        },
        "domain_mapping": {
          "type": "string",
          "title": "Domain Mapping",
          "description": "Indicator type to assign if a specific type is not associated with an observable",
          "order": 8
        },
        "email_mapping": {
          "type": "string",
          "title": "Email Mapping",
          "description": "Indicator type to assign if a specific type is not associated with an observable",
          "order": 10
        },
        "expiration_ts": {
          "type": "string",
          "title": "Expiration Time Stamp",
          "displayType": "date",
          "description": "Time stamp of when intelligence will expire on ThreatStream",
          "format": "date-time",
          "order": 5
        },
        "ip_mapping": {
          "type": "string",
          "title": "IP Mapping",
          "description": "Indicator type to assign if a specific type is not associated with an observable",
          "order": 7
        },
        "md5_mapping": {
          "type": "string",
          "title": "MD5 Mapping",
          "description": "Indicator type to assign if a specific type is not associated with an observable",
          "order": 11
        },
        "notes": {
          "type": "array",
          "title": "Notes",
          "description": "Additional details for the observable. This information is displayed in the Tags column of the ThreatStream UI e.g ['note1', 'note2', 'note3']",
          "items": {
            "type": "string"
          },
          "order": 6
        },
        "severity": {
          "type": "string",
          "title": "Severity",
          "description": "Severity you want to assign to the observable when it is imported",
          "default": "",
          "enum": [
            "low",
            "medium",
            "high",
            "very-high",
            ""
          ],
          "order": 3
        },
        "source_confidence_weight": {
          "type": "integer",
          "title": "Source Confidence Weight",
          "description": "Specifies the ratio between the amount of the source confidence of each observable and the ThreatStream confidence",
          "order": 2
        },
        "threat_type": {
          "type": "string",
          "title": "Threat Type",
          "description": "Type of threat associated with the imported observables",
          "order": 13
        },
        "trustedcircles": {
          "type": "array",
          "title": "Trusted Circles",
          "description": "ID of the trusted circle to which this threat data should be imported. If you want to import the threat data to multiple trusted circles, enter the list of comma-separated IDs e.g [1,2,3]",
          "items": {
            "type": "integer"
          },
          "order": 12
        },
        "url_mapping": {
          "type": "string",
          "title": "URL Mapping",
          "description": "Indicator type to assign if a specific type is not associated with an observable",
          "order": 9
        }
      },
      "required": [
        "classification"
      ]
    }
  }
}
    """)

    def __init__(self):
        super(self.__class__, self).__init__(self.schema)


class ImportObservableOutput(komand.Output):
    schema = json.loads("""
   {
  "type": "object",
  "title": "Variables",
  "properties": {
    "results": {
      "$ref": "#/definitions/import_observable_response",
      "title": "Results",
      "description": "Results from importing observable(s)",
      "order": 1
    }
  },
  "definitions": {
    "import_observable_response": {
      "type": "object",
      "title": "import_observable_response",
      "properties": {
        "import_session_id": {
          "type": "string",
          "title": "Import Session ID",
          "description": "ID for import session",
          "order": 3
        },
        "job_id": {
          "type": "string",
          "title": "Job ID",
          "description": "Job ID",
          "order": 1
        },
        "success": {
          "type": "boolean",
          "title": "Success",
          "description": "If import was successful",
          "order": 2
        }
      }
    }
  }
}
    """)

    def __init__(self):
        super(self.__class__, self).__init__(self.schema)

[(20, 'json.loads', 'json.loads', False, 'import json\n'), (178, 'json.loads', 'json.loads', False, 'import json\n')]