import { PluginContainerData, Media, Link } from "./common.js";
import {
  GalleryOptions_Layout_Type,
  GalleryOptions_Layout_Orientation,
  GalleryOptions_ItemStyle_Crop,
  GalleryOptions_Thumbnails_Alignment
} from "./plugin_gallery.enums.js";
function galleryOptions_Layout_TypeFromJSON(object) {
  switch (object) {
    case 0:
    case "COLLAGE":
      return GalleryOptions_Layout_Type.COLLAGE;
    case 1:
    case "MASONRY":
      return GalleryOptions_Layout_Type.MASONRY;
    case 2:
    case "GRID":
      return GalleryOptions_Layout_Type.GRID;
    case 3:
    case "THUMBNAIL":
      return GalleryOptions_Layout_Type.THUMBNAIL;
    case 4:
    case "SLIDER":
      return GalleryOptions_Layout_Type.SLIDER;
    case 5:
    case "SLIDESHOW":
      return GalleryOptions_Layout_Type.SLIDESHOW;
    case 6:
    case "PANORAMA":
      return GalleryOptions_Layout_Type.PANORAMA;
    case 7:
    case "COLUMN":
      return GalleryOptions_Layout_Type.COLUMN;
    case 8:
    case "MAGIC":
      return GalleryOptions_Layout_Type.MAGIC;
    case 9:
    case "FULLSIZE":
      return GalleryOptions_Layout_Type.FULLSIZE;
    case -1:
    case "UNRECOGNIZED":
    default:
      return GalleryOptions_Layout_Type.UNRECOGNIZED;
  }
}
function galleryOptions_Layout_TypeToJSON(object) {
  switch (object) {
    case GalleryOptions_Layout_Type.COLLAGE:
      return "COLLAGE";
    case GalleryOptions_Layout_Type.MASONRY:
      return "MASONRY";
    case GalleryOptions_Layout_Type.GRID:
      return "GRID";
    case GalleryOptions_Layout_Type.THUMBNAIL:
      return "THUMBNAIL";
    case GalleryOptions_Layout_Type.SLIDER:
      return "SLIDER";
    case GalleryOptions_Layout_Type.SLIDESHOW:
      return "SLIDESHOW";
    case GalleryOptions_Layout_Type.PANORAMA:
      return "PANORAMA";
    case GalleryOptions_Layout_Type.COLUMN:
      return "COLUMN";
    case GalleryOptions_Layout_Type.MAGIC:
      return "MAGIC";
    case GalleryOptions_Layout_Type.FULLSIZE:
      return "FULLSIZE";
    default:
      return "UNKNOWN";
  }
}
function galleryOptions_Layout_OrientationFromJSON(object) {
  switch (object) {
    case 0:
    case "ROWS":
      return GalleryOptions_Layout_Orientation.ROWS;
    case 1:
    case "COLUMNS":
      return GalleryOptions_Layout_Orientation.COLUMNS;
    case -1:
    case "UNRECOGNIZED":
    default:
      return GalleryOptions_Layout_Orientation.UNRECOGNIZED;
  }
}
function galleryOptions_Layout_OrientationToJSON(object) {
  switch (object) {
    case GalleryOptions_Layout_Orientation.ROWS:
      return "ROWS";
    case GalleryOptions_Layout_Orientation.COLUMNS:
      return "COLUMNS";
    default:
      return "UNKNOWN";
  }
}
function galleryOptions_ItemStyle_CropFromJSON(object) {
  switch (object) {
    case 0:
    case "FILL":
      return GalleryOptions_ItemStyle_Crop.FILL;
    case 1:
    case "FIT":
      return GalleryOptions_ItemStyle_Crop.FIT;
    case -1:
    case "UNRECOGNIZED":
    default:
      return GalleryOptions_ItemStyle_Crop.UNRECOGNIZED;
  }
}
function galleryOptions_ItemStyle_CropToJSON(object) {
  switch (object) {
    case GalleryOptions_ItemStyle_Crop.FILL:
      return "FILL";
    case GalleryOptions_ItemStyle_Crop.FIT:
      return "FIT";
    default:
      return "UNKNOWN";
  }
}
function galleryOptions_Thumbnails_AlignmentFromJSON(object) {
  switch (object) {
    case 0:
    case "TOP":
      return GalleryOptions_Thumbnails_Alignment.TOP;
    case 1:
    case "RIGHT":
      return GalleryOptions_Thumbnails_Alignment.RIGHT;
    case 2:
    case "BOTTOM":
      return GalleryOptions_Thumbnails_Alignment.BOTTOM;
    case 3:
    case "LEFT":
      return GalleryOptions_Thumbnails_Alignment.LEFT;
    case 4:
    case "NONE":
      return GalleryOptions_Thumbnails_Alignment.NONE;
    case -1:
    case "UNRECOGNIZED":
    default:
      return GalleryOptions_Thumbnails_Alignment.UNRECOGNIZED;
  }
}
function galleryOptions_Thumbnails_AlignmentToJSON(object) {
  switch (object) {
    case GalleryOptions_Thumbnails_Alignment.TOP:
      return "TOP";
    case GalleryOptions_Thumbnails_Alignment.RIGHT:
      return "RIGHT";
    case GalleryOptions_Thumbnails_Alignment.BOTTOM:
      return "BOTTOM";
    case GalleryOptions_Thumbnails_Alignment.LEFT:
      return "LEFT";
    case GalleryOptions_Thumbnails_Alignment.NONE:
      return "NONE";
    default:
      return "UNKNOWN";
  }
}
const baseGalleryOptions = {};
const GalleryOptions = {
  fromJSON(object) {
    const message = { ...baseGalleryOptions };
    message.layout = object.layout !== void 0 && object.layout !== null ? GalleryOptions_Layout.fromJSON(object.layout) : void 0;
    message.item = object.item !== void 0 && object.item !== null ? GalleryOptions_ItemStyle.fromJSON(object.item) : void 0;
    message.thumbnails = object.thumbnails !== void 0 && object.thumbnails !== null ? GalleryOptions_Thumbnails.fromJSON(object.thumbnails) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.layout !== void 0 && (obj.layout = message.layout ? GalleryOptions_Layout.toJSON(message.layout) : void 0);
    message.item !== void 0 && (obj.item = message.item ? GalleryOptions_ItemStyle.toJSON(message.item) : void 0);
    message.thumbnails !== void 0 && (obj.thumbnails = message.thumbnails ? GalleryOptions_Thumbnails.toJSON(message.thumbnails) : void 0);
    return obj;
  }
};
const baseGalleryOptions_Layout = {
  type: GalleryOptions_Layout_Type.COLLAGE,
  orientation: GalleryOptions_Layout_Orientation.ROWS
};
const GalleryOptions_Layout = {
  fromJSON(object) {
    const message = { ...baseGalleryOptions_Layout };
    message.type = object.type !== void 0 && object.type !== null ? galleryOptions_Layout_TypeFromJSON(object.type) : GalleryOptions_Layout_Type.COLLAGE;
    message.horizontalScroll = object.horizontalScroll !== void 0 && object.horizontalScroll !== null ? Boolean(object.horizontalScroll) : void 0;
    message.orientation = object.orientation !== void 0 && object.orientation !== null ? galleryOptions_Layout_OrientationFromJSON(object.orientation) : GalleryOptions_Layout_Orientation.ROWS;
    message.numberOfColumns = object.numberOfColumns !== void 0 && object.numberOfColumns !== null ? Number(object.numberOfColumns) : void 0;
    message.mobileNumberOfColumns = object.mobileNumberOfColumns !== void 0 && object.mobileNumberOfColumns !== null ? Number(object.mobileNumberOfColumns) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.type !== void 0 && (obj.type = galleryOptions_Layout_TypeToJSON(message.type));
    message.horizontalScroll !== void 0 && (obj.horizontalScroll = message.horizontalScroll);
    message.orientation !== void 0 && (obj.orientation = galleryOptions_Layout_OrientationToJSON(
      message.orientation
    ));
    message.numberOfColumns !== void 0 && (obj.numberOfColumns = message.numberOfColumns);
    message.mobileNumberOfColumns !== void 0 && (obj.mobileNumberOfColumns = message.mobileNumberOfColumns);
    return obj;
  }
};
const baseGalleryOptions_ItemStyle = {
  crop: GalleryOptions_ItemStyle_Crop.FILL
};
const GalleryOptions_ItemStyle = {
  fromJSON(object) {
    const message = {
      ...baseGalleryOptions_ItemStyle
    };
    message.targetSize = object.targetSize !== void 0 && object.targetSize !== null ? Number(object.targetSize) : void 0;
    message.ratio = object.ratio !== void 0 && object.ratio !== null ? Number(object.ratio) : void 0;
    message.crop = object.crop !== void 0 && object.crop !== null ? galleryOptions_ItemStyle_CropFromJSON(object.crop) : GalleryOptions_ItemStyle_Crop.FILL;
    message.spacing = object.spacing !== void 0 && object.spacing !== null ? Number(object.spacing) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.targetSize !== void 0 && (obj.targetSize = message.targetSize);
    message.ratio !== void 0 && (obj.ratio = message.ratio);
    message.crop !== void 0 && (obj.crop = galleryOptions_ItemStyle_CropToJSON(message.crop));
    message.spacing !== void 0 && (obj.spacing = message.spacing);
    return obj;
  }
};
const baseGalleryOptions_Thumbnails = {
  placement: GalleryOptions_Thumbnails_Alignment.TOP
};
const GalleryOptions_Thumbnails = {
  fromJSON(object) {
    const message = {
      ...baseGalleryOptions_Thumbnails
    };
    message.placement = object.placement !== void 0 && object.placement !== null ? galleryOptions_Thumbnails_AlignmentFromJSON(object.placement) : GalleryOptions_Thumbnails_Alignment.TOP;
    message.spacing = object.spacing !== void 0 && object.spacing !== null ? Number(object.spacing) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.placement !== void 0 && (obj.placement = galleryOptions_Thumbnails_AlignmentToJSON(
      message.placement
    ));
    message.spacing !== void 0 && (obj.spacing = message.spacing);
    return obj;
  }
};
const baseGalleryData = {};
const GalleryData = {
  fromJSON(object) {
    const message = { ...baseGalleryData };
    message.containerData = object.containerData !== void 0 && object.containerData !== null ? PluginContainerData.fromJSON(object.containerData) : void 0;
    message.items = (object.items ?? []).map(
      (e) => GalleryData_Item.fromJSON(e)
    );
    message.options = object.options !== void 0 && object.options !== null ? GalleryOptions.fromJSON(object.options) : void 0;
    message.disableExpand = object.disableExpand !== void 0 && object.disableExpand !== null ? Boolean(object.disableExpand) : void 0;
    message.disableDownload = object.disableDownload !== void 0 && object.disableDownload !== null ? Boolean(object.disableDownload) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.containerData !== void 0 && (obj.containerData = message.containerData ? PluginContainerData.toJSON(message.containerData) : void 0);
    if (message.items) {
      obj.items = message.items.map(
        (e) => e ? GalleryData_Item.toJSON(e) : void 0
      );
    } else {
      obj.items = [];
    }
    message.options !== void 0 && (obj.options = message.options ? GalleryOptions.toJSON(message.options) : void 0);
    message.disableExpand !== void 0 && (obj.disableExpand = message.disableExpand);
    message.disableDownload !== void 0 && (obj.disableDownload = message.disableDownload);
    return obj;
  }
};
const baseGalleryData_Item = {};
const GalleryData_Item = {
  fromJSON(object) {
    const message = { ...baseGalleryData_Item };
    message.image = object.image !== void 0 && object.image !== null ? GalleryData_Item_Image.fromJSON(object.image) : void 0;
    message.video = object.video !== void 0 && object.video !== null ? GalleryData_Item_Video.fromJSON(object.video) : void 0;
    message.title = object.title !== void 0 && object.title !== null ? String(object.title) : void 0;
    message.altText = object.altText !== void 0 && object.altText !== null ? String(object.altText) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.image !== void 0 && (obj.image = message.image ? GalleryData_Item_Image.toJSON(message.image) : void 0);
    message.video !== void 0 && (obj.video = message.video ? GalleryData_Item_Video.toJSON(message.video) : void 0);
    message.title !== void 0 && (obj.title = message.title);
    message.altText !== void 0 && (obj.altText = message.altText);
    return obj;
  }
};
const baseGalleryData_Item_Video = {};
const GalleryData_Item_Video = {
  fromJSON(object) {
    const message = { ...baseGalleryData_Item_Video };
    message.media = object.media !== void 0 && object.media !== null ? Media.fromJSON(object.media) : void 0;
    message.thumbnail = object.thumbnail !== void 0 && object.thumbnail !== null ? Media.fromJSON(object.thumbnail) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.media !== void 0 && (obj.media = message.media ? Media.toJSON(message.media) : void 0);
    message.thumbnail !== void 0 && (obj.thumbnail = message.thumbnail ? Media.toJSON(message.thumbnail) : void 0);
    return obj;
  }
};
const baseGalleryData_Item_Image = {};
const GalleryData_Item_Image = {
  fromJSON(object) {
    const message = { ...baseGalleryData_Item_Image };
    message.media = object.media !== void 0 && object.media !== null ? Media.fromJSON(object.media) : void 0;
    message.link = object.link !== void 0 && object.link !== null ? Link.fromJSON(object.link) : void 0;
    return message;
  },
  toJSON(message) {
    const obj = {};
    message.media !== void 0 && (obj.media = message.media ? Media.toJSON(message.media) : void 0);
    message.link !== void 0 && (obj.link = message.link ? Link.toJSON(message.link) : void 0);
    return obj;
  }
};
export {
  GalleryData,
  GalleryData_Item,
  GalleryData_Item_Image,
  GalleryData_Item_Video,
  GalleryOptions,
  GalleryOptions_ItemStyle,
  GalleryOptions_Layout,
  GalleryOptions_Thumbnails,
  galleryOptions_ItemStyle_CropFromJSON,
  galleryOptions_ItemStyle_CropToJSON,
  galleryOptions_Layout_OrientationFromJSON,
  galleryOptions_Layout_OrientationToJSON,
  galleryOptions_Layout_TypeFromJSON,
  galleryOptions_Layout_TypeToJSON,
  galleryOptions_Thumbnails_AlignmentFromJSON,
  galleryOptions_Thumbnails_AlignmentToJSON
};
//# sourceMappingURL=plugin_gallery.js.map
