package org.jeecg.modules.adweb.dmp.dto.google.gtm;

import com.google.common.base.Joiner;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import lombok.experimental.SuperBuilder;

import org.apache.commons.lang3.StringUtils;
import org.jeecg.modules.adweb.dmp.dto.google.ResourceDTO;

import java.util.List;

/**
 * @author wfansh
 */
@Data
@SuperBuilder
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class GTMContainerDTO extends ResourceDTO {

    private String accountId;

    private List<String> domainNames;

    private String publicId;

    private List<String> tagIds;

    private String notes;

    private List<String> usageContext;

    private String headSnippet;

    private String bodySnippet;

    private String fingerprint;

    private List<GTMTagDTO> tags;

    public static String toResourceName(String accountId, String containerId) {
        return StringUtils.isNumeric(accountId) && StringUtils.isNumeric(containerId)
                ? Joiner.on(RESOURCE_NAME_SPLITTER)
                        .join("accounts", accountId, "containers", containerId)
                : containerId;
    }
}
