"""Test meta data."""
import time

QUERIES = {
    "not_last_seen_day": '(not (specific_data.data.last_seen >= date("NOW - 1d")))',
    "exist_complex": '((({f} == ({{"$exists":true,"$ne":[]}})) and {f} != []))',
    "exist_simple": '(({f} == ({{"$exists":true,"$ne":""}})))',
}

TEST_CLIENT_CERT_NAME = "client_cert.crt"
TEST_CLIENT_CERT = """
-----BEGIN CERTIFICATE-----
MIIEtDCCApygAwIBAgIJAPuK1/Z7X2zbMA0GCSqGSIb3DQEBDQUAMFgxCzAJBgNV
BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMRkwFwYDVQQKDBBBeG9uaXVzIENJ
IFRlc3RzMRkwFwYDVQQDDBBBeG9uaXVzQ0lUZXN0c0NBMB4XDTE5MTIyNDEzMTYx
NFoXDTM5MDIyMjEzMTYxNFowgYsxCzAJBgNVBAYTAklMMREwDwYDVQQIDAhUZWwg
QXZpdjEKMAgGA1UEBwwBLjEKMAgGA1UEEQwBLjEQMA4GA1UECgwHQXhvbml1czEM
MAoGA1UECwwDUiZEMQwwCgYDVQQDDANCb2IxIzAhBgkqhkiG9w0BCQEWFGJvYkBh
eG9uaXVzdGVzdHMubGFuMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
t/p+x2hlsidVdoDkEnAV7S0t4DTQE4Iir8VGm/Rjb9Gv+O3T/VWPGYYm2roiSS0q
0DCNOSy8qx28+vccgdPdyflCte9/mas6dTRvXDM3nDLloqI9lQy8Tf1X3rhRDs8a
EZCmfiATUETPr7vp3+LjriHpSnc/siaUFdDxEWRIbAIR3zNDv7MJD7k16HQCK+5k
iCtJJXcelYC856vEASORJibUU/Q15KqgegM/ATf6NLem5fYO2dZhQMSj8nW8Cw2Q
pAo+uUdeDMLscREEG933zH0qDCNaGyjAY7JUqlHXEBtL2GSADNp2WGLyK4xMdTiB
HqGi05DvFKRXnBvs1YOdnQIDAQABo00wSzAxBgNVHSUEKjAoBggrBgEFBQcDAQYI
KwYBBQUHAwI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GkU03LtYuqiF0n1QjhWo2Lquz8Azmblti/uVfLMQqPAJRgR0ztFvaljE8
aScorJ1w+7j5IU7FRriZBrmFsWslI+nLKPa0xIGaWLzLS2PFjnzgyToEBBO61dzr
tqgHuLECgYBA5nJsbMc36x55d61/4XLkX4Pmoh/LtTEZt9LyoWXUOq86vZuP1W/u
fcCY7mv+lRAoiAC1Z38YjGgJmZINH9EoaVnZJNeaO/86qemnlwYQ5/DIViycPZWI
oXO3sikOr2yrDS95jHjVzU0iW3xzu8bM9D01swBx0T5kYKWZo4ywpQ==
-----END RSA PRIVATE KEY-----
"""

FIELD_FORMATS = [
    "discrete",
    "image",
    "date-time",
    "table",
    "ip",
    "subnet",
    "version",
    "password",
]
SCHEMA_FIELD_FORMATS = [
    "image",
    "date-time",
    "table",
    "logo",
    "tag",
    "ip",
    "subnet",
    "version",
]
SCHEMA_TYPES = ["string", "bool", "array", "integer", "number", "file"]
TAGS = ["badwolf_tag_1", "badwolf_tag_2"]

LINUX_QUERY = 'specific_data.data.os.type == "Linux"'
SHELL_ACTION_NAME = "Badwolf Shell Action"
SHELL_ACTION_CMD = "echo 'Badwolf' > /tmp/badwolf.txt"
DEPLOY_ACTION_NAME = "Badwolf Deploy Action"
DEPLOY_FILE_NAME = "badwolf.sh"
DEPLOY_FILE_CONTENTS = b"#!/bin/bash\necho badwolf!"

CREATE_EC_NAME = "Badwolf EC Example"
CREATE_EC_TRIGGER1 = {
    "name": "Trigger",
    "conditions": {
        "new_entities": False,
        "previous_entities": False,
        "above": 1,
        "below": 0,
    },
    "period": "never",
    "run_on": "AllEntities",
}

CREATE_EC_ACTION_MAIN = {
    "name": "Badwolf Create Notification {}".format(time.time()),
    "action": {"action_name": "create_notification", "config": {}},
}


CSV_FILENAME = "badwolf.csv"
CSV_FIELDS = ["mac_address", "field1"]
CSV_ROW = ["01:37:53:9E:82:7C", "e"]
CSV_FILECONTENTS = [",".join(CSV_FIELDS), ",".join(CSV_ROW)]
CSV_FILECONTENT_STR = "\r\n".join(CSV_FILECONTENTS) + "\r\n"
CSV_FILECONTENT_BYTES = CSV_FILECONTENT_STR.encode()

NORM_TYPES = [
    "string",
    "string_datetime",
    "string_image",
    "string_version",
    "string_ipaddress",
    "bool",
    "integer",
    "number",
    "complex_table",
    "complex",
    "list_integer",
    "list_string",
    "list_string",
    "list_string_version",
    "list_string_datetime",
    "list_string_subnet",
    "list_string",
    "list_string_ipaddress",
    "complex_complex",
]
SCHEMA_STR = {"name": "schema_str", "type": "string", "required": False}
SCHEMA_STR_PASSWORD = {
    "name": "schema_str_password",
    "type": "string",
    "format": "password",
    "required": False,
}
SCHEMA_STR_ENUM = {
    "name": "schema_str_enum",
    "type": "string",
    "enum": ["badwolf"],
    "required": False,
}
SCHEMA_INT = {"name": "schema_int", "type": "integer", "required": False}
SCHEMA_NUM = {"name": "schema_num", "type": "number", "required": False}
SCHEMA_BOOL = {"name": "schema_bool", "type": "bool", "required": False}
SCHEMA_ARRAY = {"name": "schema_array", "type": "array", "required": False}
SCHEMA_FILE = {"name": "schema_file", "type": "file", "required": False}
SCHEMA_UNKNOWN = {"name": "schema_unknown", "type": "badwolf", "required": False}
SCHEMAS = [
    SCHEMA_STR,
    SCHEMA_STR_PASSWORD,
    SCHEMA_STR_ENUM,
    SCHEMA_INT,
    SCHEMA_NUM,
    SCHEMA_BOOL,
    SCHEMA_ARRAY,
    SCHEMA_FILE,
]
SCHEMAS_DICT = {x["name"]: x for x in SCHEMAS}

TEST_USER = "badwolfy"
TEST_ROLE = "badwolfy"
TEST_PERM = "Restricted"
ABOUT_KEYS = ["Build Date", "Version"]
ABOUT_KEYS_EMPTY_OK = ["Version"]
# ABOUT on BUILD: ["Build Date", "Commit Date", "Commit Hash", "Version"]
# ABOUT on RELEASE: ["Build Date", "Customer ID", "Version"]
