import React from 'react';
import { FieldString, IdeFileManifest, IdeParameter } from '@looker/icons';
import { CalendarToday } from '@styled-icons/material/CalendarToday';
import { Check } from '@styled-icons/material/Check';
import { Code } from '@styled-icons/material/Code';
import { Link } from '@styled-icons/material/Link';
import { Toc } from '@styled-icons/material/Toc';
import { VpnKey } from '@styled-icons/material/VpnKey';
import { Tag } from '@styled-icons/material-rounded';
import { Email } from '@styled-icons/material-outlined';
import { TypeOfType, typeOfType } from '@looker/sdk-codegen';
export var pickType = value => {
  var typed = typeOfType(value);

  switch (typed) {
    case TypeOfType.Intrinsic:
    case TypeOfType.Complex:
      return value;

    default:
      return value.elementType;
  }
};
export var expandable = function expandable(level) {
  var maxDepth = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : -1;
  return maxDepth === -1 || level <= maxDepth;
};
export var pickTypeProps = value => pickType(value).properties;
export var typeLinkPrefix = value => {
  var typed = typeOfType(value);

  switch (typed) {
    case TypeOfType.Hash:
      return 'Hash[';

    default:
      return '';
  }
};
export var typeLinkSuffix = value => {
  var typed = typeOfType(value);

  switch (typed) {
    case TypeOfType.Array:
    case TypeOfType.DelimArray:
      return '[]';

    case TypeOfType.Hash:
      return ']';

    default:
      return '';
  }
};
export var typeIcon = value => {
  switch (value.className) {
    case 'ArrayType':
      return {
        icon: React.createElement(Toc, null),
        title: value.jsonName
      };

    case 'DelimArrayType':
      return {
        icon: React.createElement(Toc, null),
        title: value.jsonName
      };

    case 'HashType':
      return {
        icon: React.createElement(IdeFileManifest, null),
        title: value.jsonName
      };

    case 'EnumType':
      return {
        icon: React.createElement(IdeParameter, null),
        title: value.jsonName
      };
  }

  var type = pickType(value);

  switch (type.jsonName) {
    case 'boolean':
      return {
        icon: React.createElement(Check, null),
        title: type.jsonName
      };

    case 'int64':
    case 'integer':
    case 'float':
    case 'double':
      return {
        icon: React.createElement(Tag, null),
        title: type.jsonName
      };

    case 'string':
    case 'hostname':
    case 'uuid':
    case 'ipv4':
    case 'ipv6':
      return {
        icon: React.createElement(FieldString, null),
        title: type.jsonName
      };

    case 'email':
      return {
        icon: React.createElement(Email, null),
        title: type.jsonName
      };

    case 'password':
      return {
        icon: React.createElement(VpnKey, null),
        title: type.jsonName
      };

    case 'uri':
      return {
        icon: React.createElement(Link, null),
        title: type.jsonName
      };

    case 'datetime':
      return {
        icon: React.createElement(CalendarToday, null),
        title: type.jsonName
      };

    default:
      return {
        icon: React.createElement(Code, null),
        title: type.jsonName
      };
  }
};
//# sourceMappingURL=exploreUtils.js.map