package com.rj.dto;

import lombok.Getter;

import java.io.InputStream;

/**
 * 客户照片预览：从 MinIO 打开流的结果。
 */
@Getter
public class CustomerPhotoPreviewResult {

    public enum Status {
        OK,
        NOT_FOUND,
        BAD_REQUEST
    }

    private final Status status;
    private final InputStream inputStream;
    private final String contentType;

    private CustomerPhotoPreviewResult(Status status, InputStream inputStream, String contentType) {
        this.status = status;
        this.inputStream = inputStream;
        this.contentType = contentType;
    }

    public static CustomerPhotoPreviewResult ok(InputStream inputStream, String contentType) {
        return new CustomerPhotoPreviewResult(Status.OK, inputStream, contentType);
    }

    public static CustomerPhotoPreviewResult notFound() {
        return new CustomerPhotoPreviewResult(Status.NOT_FOUND, null, null);
    }

    public static CustomerPhotoPreviewResult badRequest() {
        return new CustomerPhotoPreviewResult(Status.BAD_REQUEST, null, null);
    }
}
