import {CropRectangle} from "./types";

/**
 *  A class that represents a PDF signing certificate (.PFX or .p12) format which can be used to digitally sign a
 *  PDF. This protecting it from alteration.
 */
export interface DigitalSignature {
	/**
	 * Url to use for timestamping
	 */
	timeStampUrl ?: string | undefined;
	/**
	 * The file path to a .pfx or .p12 digital signing certificate which may be generated using Adobe Acrobat Viewer.
	 */
	certificatePath ?: string | undefined;
	/**
	 * The file buffer of a .pfx or .p12 digital signing certificate which may be generated using Adobe Acrobat Viewer.
	 */
	certificateBuffer ?: Buffer | undefined;
	/**
	 * The certificate password as a String
	 */
	certificatePassword ?: string | undefined;
	/**
	 * The reason the PDF was signed
	 */
	signingReason ?: string | undefined;
	/**
	 * The physical location the PDF was signed
	 */
	signingLocation ?: string | undefined;
	/**
	 * The date and time of the digital signature. If left null, the signature will be timestamped at the
	 * millisecond that the PdfDocument is saved to Disk or Stream.
	 */
	signatureDate ?: Date | undefined;
	/**
	 * A visual image for the sign, often a PNG of a human signature or company stamp.
	 *
	 * This appends a visual signature in addition to  cryptographic signing.
	 */
	signatureImage?: SignatureImage | undefined;
}

/**
 * PDF digital signature image data and position
 */
export interface SignatureImage {
	/**
	 * An image file path
	 */
	SignatureImagePath ?: string | undefined;
	/**
	 * An image binary data
	 */
	SignatureImageBuffer ?: Buffer | undefined;
	/**
	 * An CropRectangle image position
	 */
	SignatureImagePosition?: CropRectangle | undefined;
	/**
	 * 0-based PDF page index
	 */
	SignatureImagePageIndex ?: number | undefined;
}
