package com.gcsc.connection.service.dto;

import com.gcsc.connection.service.entity.SnpServiceApiSpec;

import java.time.LocalDateTime;

public record ApiSpecResponse(
    Long specId,
    Long apiId,
    String sampleUrl,
    String sampleCode,
    String requestBodyExample,
    String responseBodyExample,
    Boolean authRequired,
    String authType,
    Boolean deprecated,
    String dataFormat,
    String referenceUrl,
    String note,
    LocalDateTime createdAt,
    LocalDateTime updatedAt
) {

    public static ApiSpecResponse from(SnpServiceApiSpec s) {
        return new ApiSpecResponse(
            s.getSpecId(),
            s.getApi().getApiId(),
            s.getSampleUrl(),
            s.getSampleCode(),
            s.getRequestBodyExample(),
            s.getResponseBodyExample(),
            s.getAuthRequired(),
            s.getAuthType(),
            s.getDeprecated(),
            s.getDataFormat(),
            s.getReferenceUrl(),
            s.getNote(),
            s.getCreatedAt(),
            s.getUpdatedAt()
        );
    }
}
