"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 plugin_button_exports = {};
__export(plugin_button_exports, {
  ButtonData: () => ButtonData,
  ButtonData_Styles: () => ButtonData_Styles,
  ButtonData_Styles_Background: () => ButtonData_Styles_Background,
  ButtonData_Styles_Border: () => ButtonData_Styles_Border,
  ButtonData_Styles_Colors: () => ButtonData_Styles_Colors,
  buttonData_Styles_Background_TypeFromJSON: () => buttonData_Styles_Background_TypeFromJSON,
  buttonData_Styles_Background_TypeToJSON: () => buttonData_Styles_Background_TypeToJSON,
  buttonData_TypeFromJSON: () => buttonData_TypeFromJSON,
  buttonData_TypeToJSON: () => buttonData_TypeToJSON
});
module.exports = __toCommonJS(plugin_button_exports);
var import_common = require("./common.js");
var import_plugin_button_enums = require("./plugin_button.enums.js");
function buttonData_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "LINK":
      return import_plugin_button_enums.ButtonData_Type.LINK;
    case 1:
    case "ACTION":
      return import_plugin_button_enums.ButtonData_Type.ACTION;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_plugin_button_enums.ButtonData_Type.UNRECOGNIZED;
  }
}
function buttonData_TypeToJSON(object) {
  switch (object) {
    case import_plugin_button_enums.ButtonData_Type.LINK:
      return "LINK";
    case import_plugin_button_enums.ButtonData_Type.ACTION:
      return "ACTION";
    default:
      return "UNKNOWN";
  }
}
function buttonData_Styles_Background_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "COLOR":
      return import_plugin_button_enums.ButtonData_Styles_Background_Type.COLOR;
    case 1:
    case "GRADIENT":
      return import_plugin_button_enums.ButtonData_Styles_Background_Type.GRADIENT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return import_plugin_button_enums.ButtonData_Styles_Background_Type.UNRECOGNIZED;
  }
}
function buttonData_Styles_Background_TypeToJSON(object) {
  switch (object) {
    case import_plugin_button_enums.ButtonData_Styles_Background_Type.COLOR:
      return "COLOR";
    case import_plugin_button_enums.ButtonData_Styles_Background_Type.GRADIENT:
      return "GRADIENT";
    default:
      return "UNKNOWN";
  }
}
const baseButtonData = { type: import_plugin_button_enums.ButtonData_Type.LINK };
const ButtonData = {
  fromJSON(object) {
    const message = { ...baseButtonData };
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? import_common.PluginContainerData.fromJSON(object.containerData) : void 0;
    message.type = object.type !== void 0 && object.type !== null ? buttonData_TypeFromJSON(object.type) : import_plugin_button_enums.ButtonData_Type.LINK;
    message.styles = object.styles !== void 0 && object.styles !== null ? ButtonData_Styles.fromJSON(object.styles) : void 0;
    message.text = object.text !== void 0 && object.text !== null ? String(object.text) : void 0;
    message.link = object.link !== void 0 && object.link !== null ? import_common.Link.fromJSON(object.link) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.containerData !== void 0 && (obj.containerData = message.containerData ? import_common.PluginContainerData.toJSON(message.containerData) : void 0);
    message.type !== void 0 && (obj.type = buttonData_TypeToJSON(message.type));
    message.styles !== void 0 && (obj.styles = message.styles ? ButtonData_Styles.toJSON(message.styles) : void 0);
    message.text !== void 0 && (obj.text = message.text);
    message.link !== void 0 && (obj.link = message.link ? import_common.Link.toJSON(message.link) : void 0);
    return obj;
  }
};
const baseButtonData_Styles = {};
const ButtonData_Styles = {
  fromJSON(object) {
    const message = { ...baseButtonData_Styles };
    message.border = object.border !== void 0 && object.border !== null ? ButtonData_Styles_Border.fromJSON(object.border) : void 0;
    message.colors = object.colors !== void 0 && object.colors !== null ? ButtonData_Styles_Colors.fromJSON(object.colors) : void 0;
    message.borderWidth = object.borderWidth !== void 0 && object.borderWidth !== null ? Number(object.borderWidth) : void 0;
    message.borderWidthHover = object.borderWidthHover !== void 0 && object.borderWidthHover !== null ? Number(object.borderWidthHover) : void 0;
    message.borderRadius = object.borderRadius !== void 0 && object.borderRadius !== null ? Number(object.borderRadius) : void 0;
    message.borderColor = object.borderColor !== void 0 && object.borderColor !== null ? String(object.borderColor) : void 0;
    message.borderColorHover = object.borderColorHover !== void 0 && object.borderColorHover !== null ? String(object.borderColorHover) : void 0;
    message.textColor = object.textColor !== void 0 && object.textColor !== null ? String(object.textColor) : void 0;
    message.textColorHover = object.textColorHover !== void 0 && object.textColorHover !== null ? String(object.textColorHover) : void 0;
    message.backgroundColor = object.backgroundColor !== void 0 && object.backgroundColor !== null ? String(object.backgroundColor) : void 0;
    message.backgroundColorHover = object.backgroundColorHover !== void 0 && object.backgroundColorHover !== null ? String(object.backgroundColorHover) : void 0;
    message.buttonSize = object.buttonSize !== void 0 && object.buttonSize !== null ? String(object.buttonSize) : void 0;
    message.background = object.background !== void 0 && object.background !== null ? ButtonData_Styles_Background.fromJSON(object.background) : void 0;
    message.backgroundHover = object.backgroundHover !== void 0 && object.backgroundHover !== null ? ButtonData_Styles_Background.fromJSON(object.backgroundHover) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.border !== void 0 && (obj.border = message.border ? ButtonData_Styles_Border.toJSON(message.border) : void 0);
    message.colors !== void 0 && (obj.colors = message.colors ? ButtonData_Styles_Colors.toJSON(message.colors) : void 0);
    message.borderWidth !== void 0 && (obj.borderWidth = message.borderWidth);
    message.borderWidthHover !== void 0 && (obj.borderWidthHover = message.borderWidthHover);
    message.borderRadius !== void 0 && (obj.borderRadius = message.borderRadius);
    message.borderColor !== void 0 && (obj.borderColor = message.borderColor);
    message.borderColorHover !== void 0 && (obj.borderColorHover = message.borderColorHover);
    message.textColor !== void 0 && (obj.textColor = message.textColor);
    message.textColorHover !== void 0 && (obj.textColorHover = message.textColorHover);
    message.backgroundColor !== void 0 && (obj.backgroundColor = message.backgroundColor);
    message.backgroundColorHover !== void 0 && (obj.backgroundColorHover = message.backgroundColorHover);
    message.buttonSize !== void 0 && (obj.buttonSize = message.buttonSize);
    message.background !== void 0 && (obj.background = message.background ? ButtonData_Styles_Background.toJSON(message.background) : void 0);
    message.backgroundHover !== void 0 && (obj.backgroundHover = message.backgroundHover ? ButtonData_Styles_Background.toJSON(message.backgroundHover) : void 0);
    return obj;
  }
};
const baseButtonData_Styles_Colors = {};
const ButtonData_Styles_Colors = {
  fromJSON(object) {
    const message = {
      ...baseButtonData_Styles_Colors
    };
    message.text = object.text !== void 0 && object.text !== null ? String(object.text) : void 0;
    message.border = object.border !== void 0 && object.border !== null ? String(object.border) : void 0;
    message.background = object.background !== void 0 && object.background !== null ? String(object.background) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.text !== void 0 && (obj.text = message.text);
    message.border !== void 0 && (obj.border = message.border);
    message.background !== void 0 && (obj.background = message.background);
    return obj;
  }
};
const baseButtonData_Styles_Border = {};
const ButtonData_Styles_Border = {
  fromJSON(object) {
    const message = {
      ...baseButtonData_Styles_Border
    };
    message.width = object.width !== void 0 && object.width !== null ? Number(object.width) : void 0;
    message.radius = object.radius !== void 0 && object.radius !== null ? Number(object.radius) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.width !== void 0 && (obj.width = message.width);
    message.radius !== void 0 && (obj.radius = message.radius);
    return obj;
  }
};
const baseButtonData_Styles_Background = {
  type: import_plugin_button_enums.ButtonData_Styles_Background_Type.COLOR
};
const ButtonData_Styles_Background = {
  fromJSON(object) {
    const message = {
      ...baseButtonData_Styles_Background
    };
    message.type = object.type !== void 0 && object.type !== null ? buttonData_Styles_Background_TypeFromJSON(object.type) : import_plugin_button_enums.ButtonData_Styles_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 = buttonData_Styles_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=plugin_button.js.map
