# Represents the preview image for a media.
type MediaPreviewImage {
    # The preview image for the media. Returns null until status is READY.
    image: Image

    # Current status of the preview image.
    status: MediaPreviewImageStatus!
}

# Represents an image resource.
type Image implements HasMetafields {
    # A word or phrase to share the nature or contents of an image.
    altText: String

    # The original height of the image in pixels. Returns null if the image is not hosted by Shopify.
    height: Int

    # A unique identifier for the image.
    id: ID

    # Returns a metafield by namespace and key that belongs to the resource.
    metafield(namespace: String!key: String!): Metafield

    # List of metafields that belong to the resource.
    metafields(
        namespace: String
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
    ): MetafieldConnection!

    # Returns a private metafield by namespace and key that belongs to the resource.
    privateMetafield(namespace: String!key: String!): PrivateMetafield

    # List of private metafields that belong to the resource.
    privateMetafields(
        namespace: String
        first: Int
        after: String
        last: Int
        before: String
        reverse: Boolean = false
    ): PrivateMetafieldConnection!

    # The location of the image as a URL.
    #
    # If no transform options are specified, then the original image will be preserved including any pre-applied transforms.
    # All transformation options are considered "best-effort". Any transformation that the original image type doesn't support will be ignored.
    # If you need multiple variations of the same image, then you can use GraphQL aliases.
    url(transform: ImageTransformInput): URL!

    # The original width of the image in pixels. Returns null if the image is not hosted by Shopify.
    width: Int
}

# The available options for transforming an image.
#
# All transformation options are considered best effort. Any transformation that the original image type doesn't support will be ignored.
input ImageTransformInput {
    # The region of the image to remain after cropping.
    # Must be used in conjunction with the maxWidth and/or maxHeight fields, where the maxWidth and maxHeight aren't equal.
    # The crop argument should coincide with the smaller value. A smaller maxWidth indicates a LEFT or RIGHT crop, while
    # a smaller maxHeight indicates a TOP or BOTTOM crop. For example, { maxWidth: 5, maxHeight: 10, crop: LEFT } will result
    # in an image with a width of 5 and height of 10, where the right side of the image is removed.
    crop: CropRegion

    # Image width in pixels between 1 and 5760.
    maxWidth: Int

    # Image height in pixels between 1 and 5760.
    maxHeight: Int

    # Image size multiplier for high-resolution retina displays. Must be within 1..3.
    scale: Int = 1

    # Convert the source image into the preferred content type.
    # Supported conversions: .svg to .png, any file type to .jpg, and any file type to .webp.
    preferredContentType: ImageContentType
}

# Represents any file other than HTML.
type GenericFile implements File&Node {
    #A word or phrase to describe the contents or the function of a file.
    alt: String

    # The date and time (ISO 8601 format) when the file was created.
    createdAt: DateTime!

    # Any errors that have occurred on the file.
    fileErrors: [FileError!]!

    # The status of the file.
    fileStatus: FileStatus!

    # A globally-unique identifier.
    id: ID!

    # The generic file's MIME type.
    mimeType: String

    # The generic file's size in bytes.
    originalFileSize: Int

    # The preview image for the media.
    preview: MediaPreviewImage

    # The generic file's URL.
    url: URL
}

type MediaImage implements File&Media&Node {
    # A word or phrase to share the nature or contents of a media.
    alt: String

    # The date and time (ISO 8601 format) when the file was created.
    createdAt: DateTime!

    # Any errors that have occurred on the file.
    fileErrors: [FileError!]!

    # The status of the file.
    fileStatus: FileStatus!

    # A globally-unique identifier.
    id: ID!

    # The image for the media. Returns null until status is READY.
    image: Image

    # The media content type.
    mediaContentType: MediaContentType!

    # Any errors which have occurred on the media.
    mediaErrors: [MediaError!]!

    # The warnings attached to the media.
    mediaWarnings: [MediaWarning!]!

    # The MIME type of the image.
    mimeType: String

    # The original source of the image.
    originalSource: MediaImageOriginalSource

    # The preview image for the media.
    preview: MediaPreviewImage

    # Current status of the media.
    status: MediaStatus!
}

# The original source for an image.
type MediaImageOriginalSource {
    # The size of the original file in bytes.
    fileSize: Int
}

# Represents a Shopify hosted video.
type Video implements File&Media&Node {
    # A word or phrase to share the nature or contents of a media.
    alt: String

    # The date and time (ISO 8601 format) when the file was created.
    createdAt: DateTime!

    # The video's duration in milliseconds. This value is null unless the video's status field is
    # READY.
    duration: Int

    # Any errors that have occurred on the file.
    fileErrors: [FileError!]!

    # The status of the file.
    fileStatus: FileStatus!

    # The video's filename.
    filename: String!

    # A globally-unique identifier.
    id: ID!

    # The media content type.
    mediaContentType: MediaContentType!

    # Any errors which have occurred on the media.
    mediaErrors: [MediaError!]!

    # The warnings attached to the media.
    mediaWarnings: [MediaWarning!]!

    # The video's original source. This value is null unless the video's status field is
    # READY.
    originalSource: VideoSource

    # The preview image for the media.
    preview: MediaPreviewImage

    # The video's sources. This value is empty unless the video's status field is
    # READY.
    sources: [VideoSource!]!

    # Current status of the media.
    status: MediaStatus!
}

# Represents a source for a Shopify hosted video.
#
# Types of sources include the original video, lower resolution versions of the original video,
# and an m3u8 playlist file.
#
# Only videos with a status field
# of READY have sources.
type VideoSource {
    # The video source's file size in bytes.
    fileSize: Int

    # The video source's file format extension.
    format: String!

    # The video source's height.
    height: Int!

    # The video source's MIME type.
    mimeType: String!

    # The video source's URL.
    url: String!

    # The video source's width.
    width: Int!
}
