#ifndef COMPONENTS_ATTRIBUTION_REPORTING_AGGREGATABLE_TRIGGER_CONFIG_H_
#define COMPONENTS_ATTRIBUTION_REPORTING_AGGREGATABLE_TRIGGER_CONFIG_H_
#include <optional>
#include <string>
#include "base/component_export.h"
#include "base/types/expected.h"
#include "components/attribution_reporting/aggregatable_filtering_id_max_bytes.h"
#include "components/attribution_reporting/source_registration_time_config.mojom.h"
#include "components/attribution_reporting/trigger_registration_error.mojom-forward.h"
namespace base {
class DictValue;
}
namespace attribution_reporting {
class COMPONENT_EXPORT(ATTRIBUTION_REPORTING) AggregatableTriggerConfig {
public:
static base::expected<AggregatableTriggerConfig,
mojom::TriggerRegistrationError>
Parse(base::DictValue&);
static std::optional<AggregatableTriggerConfig> Create(
mojom::SourceRegistrationTimeConfig,
std::optional<std::string> trigger_context_id,
AggregatableFilteringIdsMaxBytes);
AggregatableTriggerConfig();
AggregatableTriggerConfig(const AggregatableTriggerConfig&);
AggregatableTriggerConfig& operator=(const AggregatableTriggerConfig&);
AggregatableTriggerConfig(AggregatableTriggerConfig&&);
AggregatableTriggerConfig& operator=(AggregatableTriggerConfig&&);
~AggregatableTriggerConfig();
friend bool operator==(const AggregatableTriggerConfig&,
const AggregatableTriggerConfig&) = default;
void Serialize(base::DictValue&) const;
bool ShouldCauseAReportToBeSentUnconditionally() const;
mojom::SourceRegistrationTimeConfig source_registration_time_config() const {
return source_registration_time_config_;
}
const std::optional<std::string>& trigger_context_id() const {
return trigger_context_id_;
}
AggregatableFilteringIdsMaxBytes aggregatable_filtering_id_max_bytes() const {
return aggregatable_filtering_id_max_bytes_;
}
private:
AggregatableTriggerConfig(mojom::SourceRegistrationTimeConfig,
std::optional<std::string> trigger_context_id,
AggregatableFilteringIdsMaxBytes);
mojom::SourceRegistrationTimeConfig source_registration_time_config_ =
mojom::SourceRegistrationTimeConfig::kExclude;
std::optional<std::string> trigger_context_id_;
AggregatableFilteringIdsMaxBytes aggregatable_filtering_id_max_bytes_;
};
}
#endif