//
//  XYApiShares.h
//  XYSDK
//
//  Created by 史良 on 2021/6/4.
//  Copyright © 2021 刘磊. All rights reserved.
//

#ifndef XYApiShares_h
#define XYApiShares_h

#pragma mark - 新版分享
#pragma mark - 分享 分享内容模块

#import <UIKit/UIKit.h>
#import "XYApiEnumerations.h"
#import <Photos/PHAsset.h>

@interface XYShareFBImageConfig : NSMutableDictionary
@end
@interface XYShareFBVideoConfig : NSMutableDictionary
@end
@protocol XYShareFBConfigProtocol <NSObject>


/// 创建facebook图片配置
/// @param image 图片
/// @param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the application
- (XYShareFBImageConfig *)createFBImageWith:(UIImage *)image
                        userGenerated:(BOOL)userGenerated;


/// 创建facebook图片配置
/// @param imageURL The URL to the photo； 沙盒URL
/// @param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the application
- (XYShareFBImageConfig *)createFBImageWithUrl:(NSURL *)imageURL
                        userGenerated:(BOOL)userGenerated;


/// 创建facebook图片配置 相册中asset
/// @param photoAsset The PHAsset that represents the photo in the Photos library.
/// @param userGenerated Specifies whether the photo represented by the receiver was generated by the user or by the application
- (XYShareFBImageConfig *)createFBImageWithAsset:(PHAsset *)photoAsset
                              userGenerated:(BOOL)userGenerated;


/// 创建Facebook视频配置
/// @param data The NSData object that holds the raw video data
/// @param previewPhoto The photo that represents the video. 可以不设置预览图传nil即可
- (XYShareFBVideoConfig *)createFBVideoWithData:(NSData *)data
                                   previewPhoto:(XYShareFBImageConfig *)previewPhoto;


/// 创建Facebook视频配置 参考Fb分享 从相册中选择视频文件后取info中数据
/// @param videoAsset The PHAsset that represents the video in the Photos library
/// @param previewPhoto The photo that represents the video. 可以不设置预览图传nil即可
- (XYShareFBVideoConfig *)createFBVideoWithAsset:(PHAsset *)videoAsset
                                   previewPhoto:(XYShareFBImageConfig *)previewPhoto;


/// 创建Facebook视频配置 参考Fb分享 从相册中选择视频文件后取info中数据
/// @param VideoURL he URL to the video. Must refer to an asset file., 
/// @param previewPhoto The photo that represents the video. 可以不设置预览图传nil即可
- (XYShareFBVideoConfig *)createFBVideoWithVideoURL:(NSURL *)VideoURL
                                   previewPhoto:(XYShareFBImageConfig *)previewPhoto;


/// fb分享 当有特殊需求时 用来透传特殊参数配置 平时不用调用 以下参数官方参考 https://developers.facebook.com/docs/sharing/ios
/// @param quote If specified, the quote text will render with custom styling on top of the link.
/// @param hashTagString Hashtag for the content being shared.
/// @param peopleIDs  List of IDs for taggable people to tag with this content.
/// @param placeID The ID for a place to tag with this content
/// @param ref A value to be added to the referrer URL when a person follows a link from this shared content on feed.
/// @param pageID For shares into Messenger, this pageID will be used to map the app to page and attach attribution to the share.
- (void)addFBConfigWithQuote:(NSString *)quote
               hashTagString:(NSString *)hashTagString
                   peopleIDs:(NSArray<NSString *> *)peopleIDs
                     placeID:(NSString *)placeID
                         ref:(NSString *)ref
                      pageID:(NSString *)pageID;
    


@end


@interface XYShareBaseContent : NSObject<XYShareFBConfigProtocol>

/// 创建分享内容对象
/// @param shareChannel 分享渠道
+ (instancetype)createShareContentWith:(XYShareChannelType)shareChannel;


@end


/// 文本、连接类分享
@interface XYShareMessageContent : XYShareBaseContent

/// fb链接分享
/// @param contentURL This URL will be checked for all link meta tags for linking in platform specific ways.  See documentation for App Links (https://developers.facebook.com/docs/applinks/)
- (void)configFBContentURLWith:(NSURL *)contentURL;

@end


/**
 用户可以使用分享对话框或自定义界面，通过您的应用将照片分享到 Facebook：

 照片大小必须小于 12MB
 用户需要安装版本 7.0 或以上的原生 iOS 版 Facebook 应用
 */
@interface XYShareImageContent : XYShareBaseContent


/// Facebook图片分享  图片配置数组中图片类型需要统一 如：都是UIImage类型、或者都是 本地图片URL类型、 或者都是相册中PHAsset类型
/// @param fbImageConfigAry 图片配置列表 可以为单张图片
- (void)configFBContentWith:(NSMutableArray<XYShareFBImageConfig *> *)fbImageConfigAry;



@end


/**
 应用用户可通过分享对话框或您专属的自定义界面将视频分享到 Facebook：

 视频大小必须小于 50MB。
 分享内容的用户应安装版本 26.0 或以上的 iOS 版 Facebook 客户端。
 */
@interface XYShareVideoContent : XYShareBaseContent


- (void)configFBContentWith:(XYShareFBVideoConfig *)videoConfig;


@end

/**
 应用用户可通过分享对话框从应用向 Facebook 分享同时包含照片和视频的内容。请注意以下事项：

 用户使用的 iOS 版本至少应为 7.0。
 分享内容的用户应安装版本 52.0 或以上的 iOS 版 Facebook 客户端。
 照片大小必须小于 12MB，视频大小必须小于 50MB。
 用户最多可以分享 1 个视频加 29 张照片，或最多分享 30 张照片。
 */
@interface XYShareMediaContent : XYShareBaseContent


- (void)configFBContentWith:(NSMutableArray<NSMutableDictionary *> *)mediaConfigList;

@end




#endif /* XYApiShares_h */



