import type {
    InputMediaContact,
    InputMediaGeo,
    InputMediaGeoLive,
    InputMediaVenue,
    InputMediaWebpage,
} from '../../media/index.js'
import type { InputText } from '../../misc/entities.js'
import type { ReplyMarkup } from '../index.js'

/**
 * Inline message containing only text
 */
export interface InputInlineMessageText {
    type: 'text'

    /**
     * Text of the message
     */
    text: InputText

    /**
     * Message reply markup
     */
    replyMarkup?: ReplyMarkup

    /**
     * Whether to disable links preview in this message
     */
    disableWebPreview?: boolean

    /**
     * Whether to invert media position.
     *
     * Currently only supported for web previews and makes the
     * client render the preview above the caption and not below.
     */
    invertMedia?: boolean
}

/**
 * Inline message containing media, which is automatically
 * inferred from the result itself.
 */
export interface InputInlineMessageMedia {
    type: 'media'

    /**
     * Caption for the media
     */
    text?: InputText

    /**
     * Message reply markup
     */
    replyMarkup?: ReplyMarkup

    /**
     * Whether to invert media position.
     *
     * Currently only supported for web previews and makes the
     * client render the preview above the caption and not below.
     */
    invertMedia?: boolean
}

/**
 * Inline message containing a geolocation
 */
export interface InputInlineMessageGeo extends InputMediaGeo {
    /**
     * Message's reply markup
     */
    replyMarkup?: ReplyMarkup
}

/**
 * Inline message containing a live geolocation
 */
export interface InputInlineMessageGeoLive extends InputMediaGeoLive {
    /**
     * Message's reply markup
     */
    replyMarkup?: ReplyMarkup
}

/**
 * Inline message containing a venue
 */
export interface InputInlineMessageVenue extends InputMediaVenue {
    /**
     * Message's reply markup
     */
    replyMarkup?: ReplyMarkup
}

/**
 * Inline message containing a game
 */
export interface InputInlineMessageGame {
    type: 'game'

    /**
     * Message's reply markup
     */
    replyMarkup?: ReplyMarkup
}

/**
 * Inline message containing a contact
 */
export interface InputInlineMessageContact extends InputMediaContact {
    /**
     * Message's reply markup
     */
    replyMarkup?: ReplyMarkup
}

export interface InputInlineMessageWebpage extends InputMediaWebpage {
    /**
     * Text of the message
     */
    text: InputText

    /**
     * Message reply markup
     */
    replyMarkup?: ReplyMarkup

    /**
     * Whether to invert media position.
     *
     * Currently only supported for web previews and makes the
     * client render the preview above the caption and not below.
     */
    invertMedia?: boolean
}

export type InputInlineMessage =
  | InputInlineMessageText
  | InputInlineMessageMedia
  | InputInlineMessageGeo
  | InputInlineMessageGeoLive
  | InputInlineMessageVenue
  | InputInlineMessageGame
  | InputInlineMessageContact
  | InputInlineMessageWebpage
