// This file was auto-generated by Fern from our API Definition.

import type * as Intercom from "../index.js";

/**
 * You can create a message
 */
export type CreateMessageRequest = Intercom.CreateMessageRequest.Email | Intercom.CreateMessageRequest.Inapp;

export namespace CreateMessageRequest {
    export interface Email {
        message_type: "email";
        /** The title of the email. */
        subject: string;
        /** The content of the message. HTML and plaintext are supported. */
        body: string;
        /** The style of the outgoing message. Possible values `plain` or `personal`. */
        template: string;
        /** The sender of the message. If not provided, the default sender will be used. */
        from: CreateMessageRequestWithEmail.From;
        /** The sender of the message. If not provided, the default sender will be used. */
        to: CreateMessageRequestWithEmail.To;
        /** The time the message was created. If not provided, the current time will be used. */
        created_at?: number;
        /** Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. */
        create_conversation_without_contact_reply?: boolean;
    }

    export namespace CreateMessageRequestWithEmail {
        /**
         * The sender of the message. If not provided, the default sender will be used.
         */
        export interface From {
            /** Always `admin`. */
            type: "admin";
            /** The identifier for the admin which is given by Intercom. */
            id: number;
        }

        /**
         * The sender of the message. If not provided, the default sender will be used.
         */
        export interface To {
            /** The role associated to the contact - `user` or `lead`. */
            type: To.Type;
            /** The identifier for the contact which is given by Intercom. */
            id: string;
        }

        export namespace To {
            /** The role associated to the contact - `user` or `lead`. */
            export const Type = {
                User: "user",
                Lead: "lead",
            } as const;
            export type Type = (typeof Type)[keyof typeof Type];
        }
    }

    export interface Inapp {
        message_type: "inapp";
        /** The title of the email. */
        subject?: string;
        /** The content of the message. HTML and plaintext are supported. */
        body: string;
        /** The style of the outgoing message. Possible values `plain` or `personal`. */
        template?: string;
        /** The sender of the message. If not provided, the default sender will be used. */
        from: CreateMessageRequestWithInapp.From;
        /** The sender of the message. If not provided, the default sender will be used. */
        to: CreateMessageRequestWithInapp.To;
        /** The time the message was created. If not provided, the current time will be used. */
        created_at?: number;
        /** Whether a conversation should be opened in the inbox for the message without the contact replying. Defaults to false if not provided. */
        create_conversation_without_contact_reply?: boolean;
    }

    export namespace CreateMessageRequestWithInapp {
        /**
         * The sender of the message. If not provided, the default sender will be used.
         */
        export interface From {
            /** Always `admin`. */
            type: "admin";
            /** The identifier for the admin which is given by Intercom. */
            id: number;
        }

        /**
         * The sender of the message. If not provided, the default sender will be used.
         */
        export interface To {
            /** The role associated to the contact - `user` or `lead`. */
            type: To.Type;
            /** The identifier for the contact which is given by Intercom. */
            id: string;
        }

        export namespace To {
            /** The role associated to the contact - `user` or `lead`. */
            export const Type = {
                User: "user",
                Lead: "lead",
            } as const;
            export type Type = (typeof Type)[keyof typeof Type];
        }
    }
}
