package com.dacrt.SBIABackend.dto;


import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.Collections;
import java.util.List;

// =========================================================
// SCIM List Response (Wrapper para la respuesta de lista)
// =========================================================
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ScimListResponse2<T> {

    // Schemas obligatorios para la respuesta de lista
    private final List<String> schemas = Collections.singletonList("urn:ietf:params:scim:api:messages:2.0:ListResponse");
    private int totalResults;
    private int startIndex = 1; // Usualmente 1 para el inicio
    private int itemsPerPage;

    @JsonProperty("Resources") // Okta espera "Resources" con 'R' mayúscula
    private List<T> resources;

    public ScimListResponse2(List<T> resources) {
        this.resources = resources;
        this.totalResults = resources.size();
        this.itemsPerPage = resources.size();
    }

    // Getters
    public List<String> getSchemas() { return schemas; }
    public int getTotalResults() { return totalResults; }
    public int getStartIndex() { return startIndex; }
    public int getItemsPerPage() { return itemsPerPage; }
    public List<T> getResources() { return resources; }

    // Setters (para deserialización o si se necesitan)
    public void setTotalResults(int totalResults) { this.totalResults = totalResults; }
    public void setStartIndex(int startIndex) { this.startIndex = startIndex; }
    public void setItemsPerPage(int itemsPerPage) { this.itemsPerPage = itemsPerPage; }
    public void setResources(List<T> resources) { this.resources = resources; }
}