using System.Text.Json.Serialization;
namespace AnthropicClient.Models;
///
/// Represents an image source.
///
public class ImageSource : Base64Source
{
[JsonConstructor]
internal ImageSource() : base(string.Empty, string.Empty)
{
}
///
/// Initializes a new instance of the class.
///
/// The media type of the image.
/// The data of the image.
/// Thrown when the media type is invalid.
/// Thrown when the media type or data is null.
/// A new instance of the class.
public ImageSource(string mediaType, string data) : base(mediaType, data)
{
if (ImageType.IsValidImageType(mediaType) is false)
{
throw new ArgumentException($"Invalid media type: {mediaType}");
}
MediaType = mediaType;
Data = data;
}
}