"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var node_card_exports = {};
__export(node_card_exports, {
  CardData: () => CardData,
  CardData_Background: () => CardData_Background,
  CardData_BackgroundImage: () => CardData_BackgroundImage,
  CardData_ImagePosition: () => CardData_ImagePosition,
  CardData_ImageScaling: () => CardData_ImageScaling,
  cardData_Background_TypeFromJSON: () => cardData_Background_TypeFromJSON,
  cardData_Background_TypeToJSON: () => cardData_Background_TypeToJSON,
  cardData_ImagePosition_PositionFromJSON: () => cardData_ImagePosition_PositionFromJSON,
  cardData_ImagePosition_PositionToJSON: () => cardData_ImagePosition_PositionToJSON,
  cardData_ImageScaling_ScalingFromJSON: () => cardData_ImageScaling_ScalingFromJSON,
  cardData_ImageScaling_ScalingToJSON: () => cardData_ImageScaling_ScalingToJSON
});
module.exports = __toCommonJS(node_card_exports);
var import_common = require("./common.js");
var import_node_card_enums = require("./node_card.enums.js");
function cardData_ImageScaling_ScalingFromJSON(object) {
  switch (object) {
    case 0:
    case "AUTO":
      return import_node_card_enums.CardData_ImageScaling_Scaling.AUTO;
    case 1:
    case "CONTAIN":
      return import_node_card_enums.CardData_ImageScaling_Scaling.CONTAIN;
    case 2:
    case "COVER":
      return import_node_card_enums.CardData_ImageScaling_Scaling.COVER;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_card_enums.CardData_ImageScaling_Scaling.UNRECOGNIZED;
  }
}
function cardData_ImageScaling_ScalingToJSON(object) {
  switch (object) {
    case import_node_card_enums.CardData_ImageScaling_Scaling.AUTO:
      return "AUTO";
    case import_node_card_enums.CardData_ImageScaling_Scaling.CONTAIN:
      return "CONTAIN";
    case import_node_card_enums.CardData_ImageScaling_Scaling.COVER:
      return "COVER";
    default:
      return "UNKNOWN";
  }
}
function cardData_ImagePosition_PositionFromJSON(object) {
  switch (object) {
    case 0:
    case "CENTER":
      return import_node_card_enums.CardData_ImagePosition_Position.CENTER;
    case 1:
    case "CENTER_LEFT":
      return import_node_card_enums.CardData_ImagePosition_Position.CENTER_LEFT;
    case 2:
    case "CENTER_RIGHT":
      return import_node_card_enums.CardData_ImagePosition_Position.CENTER_RIGHT;
    case 3:
    case "TOP":
      return import_node_card_enums.CardData_ImagePosition_Position.TOP;
    case 4:
    case "TOP_LEFT":
      return import_node_card_enums.CardData_ImagePosition_Position.TOP_LEFT;
    case 5:
    case "TOP_RIGHT":
      return import_node_card_enums.CardData_ImagePosition_Position.TOP_RIGHT;
    case 6:
    case "BOTTOM":
      return import_node_card_enums.CardData_ImagePosition_Position.BOTTOM;
    case 7:
    case "BOTTOM_LEFT":
      return import_node_card_enums.CardData_ImagePosition_Position.BOTTOM_LEFT;
    case 8:
    case "BOTTOM_RIGHT":
      return import_node_card_enums.CardData_ImagePosition_Position.BOTTOM_RIGHT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_card_enums.CardData_ImagePosition_Position.UNRECOGNIZED;
  }
}
function cardData_ImagePosition_PositionToJSON(object) {
  switch (object) {
    case import_node_card_enums.CardData_ImagePosition_Position.CENTER:
      return "CENTER";
    case import_node_card_enums.CardData_ImagePosition_Position.CENTER_LEFT:
      return "CENTER_LEFT";
    case import_node_card_enums.CardData_ImagePosition_Position.CENTER_RIGHT:
      return "CENTER_RIGHT";
    case import_node_card_enums.CardData_ImagePosition_Position.TOP:
      return "TOP";
    case import_node_card_enums.CardData_ImagePosition_Position.TOP_LEFT:
      return "TOP_LEFT";
    case import_node_card_enums.CardData_ImagePosition_Position.TOP_RIGHT:
      return "TOP_RIGHT";
    case import_node_card_enums.CardData_ImagePosition_Position.BOTTOM:
      return "BOTTOM";
    case import_node_card_enums.CardData_ImagePosition_Position.BOTTOM_LEFT:
      return "BOTTOM_LEFT";
    case import_node_card_enums.CardData_ImagePosition_Position.BOTTOM_RIGHT:
      return "BOTTOM_RIGHT";
    default:
      return "UNKNOWN";
  }
}
function cardData_Background_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "COLOR":
      return import_node_card_enums.CardData_Background_Type.COLOR;
    case 1:
    case "GRADIENT":
      return import_node_card_enums.CardData_Background_Type.GRADIENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_node_card_enums.CardData_Background_Type.UNRECOGNIZED;
  }
}
function cardData_Background_TypeToJSON(object) {
  switch (object) {
    case import_node_card_enums.CardData_Background_Type.COLOR:
      return "COLOR";
    case import_node_card_enums.CardData_Background_Type.GRADIENT:
      return "GRADIENT";
    default:
      return "UNKNOWN";
  }
}
const baseCardData = {};
const CardData = {
  fromJSON(object) {
    const message = { ...baseCardData };
    message.background = object.background !== void 0 && object.background !== null ? CardData_Background.fromJSON(object.background) : void 0;
    message.backgroundImage = object.backgroundImage !== void 0 && object.backgroundImage !== null ? CardData_BackgroundImage.fromJSON(object.backgroundImage) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.background !== void 0 && (obj.background = message.background ? CardData_Background.toJSON(message.background) : void 0);
    message.backgroundImage !== void 0 && (obj.backgroundImage = message.backgroundImage ? CardData_BackgroundImage.toJSON(message.backgroundImage) : void 0);
    return obj;
  }
};
const baseCardData_ImageScaling = {};
const CardData_ImageScaling = {
  fromJSON(_) {
    const message = { ...baseCardData_ImageScaling };
    return message;
  },
  toJSON(_) {
    const obj = {};
    return obj;
  }
};
const baseCardData_ImagePosition = {};
const CardData_ImagePosition = {
  fromJSON(_) {
    const message = { ...baseCardData_ImagePosition };
    return message;
  },
  toJSON(_) {
    const obj = {};
    return obj;
  }
};
const baseCardData_BackgroundImage = {
  scaling: import_node_card_enums.CardData_ImageScaling_Scaling.AUTO,
  position: import_node_card_enums.CardData_ImagePosition_Position.CENTER
};
const CardData_BackgroundImage = {
  fromJSON(object) {
    const message = {
      ...baseCardData_BackgroundImage
    };
    message.media = object.media !== void 0 && object.media !== null ? import_common.Media.fromJSON(object.media) : void 0;
    message.opacity = object.opacity !== void 0 && object.opacity !== null ? Number(object.opacity) : void 0;
    message.scaling = object.scaling !== void 0 && object.scaling !== null ? cardData_ImageScaling_ScalingFromJSON(object.scaling) : import_node_card_enums.CardData_ImageScaling_Scaling.AUTO;
    message.position = object.position !== void 0 && object.position !== null ? cardData_ImagePosition_PositionFromJSON(object.position) : import_node_card_enums.CardData_ImagePosition_Position.CENTER;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.media !== void 0 && (obj.media = message.media ? import_common.Media.toJSON(message.media) : void 0);
    message.opacity !== void 0 && (obj.opacity = message.opacity);
    message.scaling !== void 0 && (obj.scaling = cardData_ImageScaling_ScalingToJSON(message.scaling));
    message.position !== void 0 && (obj.position = cardData_ImagePosition_PositionToJSON(message.position));
    return obj;
  }
};
const baseCardData_Background = {
  type: import_node_card_enums.CardData_Background_Type.COLOR
};
const CardData_Background = {
  fromJSON(object) {
    const message = { ...baseCardData_Background };
    message.type = object.type !== void 0 && object.type !== null ? cardData_Background_TypeFromJSON(object.type) : import_node_card_enums.CardData_Background_Type.COLOR;
    message.color = object.color !== void 0 && object.color !== null ? String(object.color) : void 0;
    message.gradient = object.gradient !== void 0 && object.gradient !== null ? import_common.Gradient.fromJSON(object.gradient) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = cardData_Background_TypeToJSON(message.type));
    message.color !== void 0 && (obj.color = message.color);
    message.gradient !== void 0 && (obj.gradient = message.gradient ? import_common.Gradient.toJSON(message.gradient) : void 0);
    return obj;
  }
};
//# sourceMappingURL=node_card.js.map
