/*  Copyright (C) 2025 Freeyourgadget

    This file is part of Gadgetbridge.

    Gadgetbridge is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published
    by the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Gadgetbridge is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages;

import androidx.annotation.Nullable;

import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.FitRecordDataBuilder;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordData;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordDefinition;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordHeader;

/**
 * WARNING: This class was auto-generated, please avoid modifying it directly.
 * See {@link nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.codegen.FitCodeGen}
 *
 * @noinspection unused
 */
public class FitDiveSummary extends RecordData {
    public FitDiveSummary(final RecordDefinition recordDefinition, final RecordHeader recordHeader) {
        super(recordDefinition, recordHeader);

        final int nativeNumber = recordDefinition.getNativeFITMessage().getNumber();
        if (nativeNumber != 268) {
            throw new IllegalArgumentException("FitDiveSummary expects native messages of " + 268 + ", got " + nativeNumber);
        }
    }

    @Nullable
    public Integer getReferenceMesg() {
        return getFieldByNumber(0, Integer.class);
    }

    @Nullable
    public Integer getReferenceIndex() {
        return getFieldByNumber(1, Integer.class);
    }

    @Nullable
    public Double getAvgDepth() {
        return getFieldByNumber(2, Double.class);
    }

    @Nullable
    public Double getMaxDepth() {
        return getFieldByNumber(3, Double.class);
    }

    @Nullable
    public Long getSurfaceInterval() {
        return getFieldByNumber(4, Long.class);
    }

    @Nullable
    public Integer getStartCns() {
        return getFieldByNumber(5, Integer.class);
    }

    @Nullable
    public Integer getEndCns() {
        return getFieldByNumber(6, Integer.class);
    }

    @Nullable
    public Integer getStartN2() {
        return getFieldByNumber(7, Integer.class);
    }

    @Nullable
    public Integer getEndN2() {
        return getFieldByNumber(8, Integer.class);
    }

    @Nullable
    public Integer getO2Toxicity() {
        return getFieldByNumber(9, Integer.class);
    }

    @Nullable
    public Long getDiveNumber() {
        return getFieldByNumber(10, Long.class);
    }

    @Nullable
    public Double getBottomTime() {
        return getFieldByNumber(11, Double.class);
    }

    @Nullable
    public Float getAvgPressureSac() {
        return getFieldByNumber(12, Float.class);
    }

    @Nullable
    public Float getAvgVolumeSac() {
        return getFieldByNumber(13, Float.class);
    }

    @Nullable
    public Float getAvgRmv() {
        return getFieldByNumber(14, Float.class);
    }

    @Nullable
    public Double getDescentTime() {
        return getFieldByNumber(15, Double.class);
    }

    @Nullable
    public Double getAscentTime() {
        return getFieldByNumber(16, Double.class);
    }

    @Nullable
    public Double getAvgAscentRate() {
        return getFieldByNumber(17, Double.class);
    }

    @Nullable
    public Double getAvgDescentRate() {
        return getFieldByNumber(22, Double.class);
    }

    @Nullable
    public Double getMaxAscentRate() {
        return getFieldByNumber(23, Double.class);
    }

    @Nullable
    public Double getMaxDescentRate() {
        return getFieldByNumber(24, Double.class);
    }

    @Nullable
    public Double getHangTime() {
        return getFieldByNumber(25, Double.class);
    }

    @Nullable
    public Long getTimestamp() {
        return getFieldByNumber(253, Long.class);
    }

    /**
     * @noinspection unused
     */
    public static class Builder extends FitRecordDataBuilder {
        public Builder() {
            super(268);
        }

        public Builder setReferenceMesg(final Integer value) {
            setFieldByNumber(0, value);
            return this;
        }

        public Builder setReferenceIndex(final Integer value) {
            setFieldByNumber(1, value);
            return this;
        }

        public Builder setAvgDepth(final Double value) {
            setFieldByNumber(2, value);
            return this;
        }

        public Builder setMaxDepth(final Double value) {
            setFieldByNumber(3, value);
            return this;
        }

        public Builder setSurfaceInterval(final Long value) {
            setFieldByNumber(4, value);
            return this;
        }

        public Builder setStartCns(final Integer value) {
            setFieldByNumber(5, value);
            return this;
        }

        public Builder setEndCns(final Integer value) {
            setFieldByNumber(6, value);
            return this;
        }

        public Builder setStartN2(final Integer value) {
            setFieldByNumber(7, value);
            return this;
        }

        public Builder setEndN2(final Integer value) {
            setFieldByNumber(8, value);
            return this;
        }

        public Builder setO2Toxicity(final Integer value) {
            setFieldByNumber(9, value);
            return this;
        }

        public Builder setDiveNumber(final Long value) {
            setFieldByNumber(10, value);
            return this;
        }

        public Builder setBottomTime(final Double value) {
            setFieldByNumber(11, value);
            return this;
        }

        public Builder setAvgPressureSac(final Float value) {
            setFieldByNumber(12, value);
            return this;
        }

        public Builder setAvgVolumeSac(final Float value) {
            setFieldByNumber(13, value);
            return this;
        }

        public Builder setAvgRmv(final Float value) {
            setFieldByNumber(14, value);
            return this;
        }

        public Builder setDescentTime(final Double value) {
            setFieldByNumber(15, value);
            return this;
        }

        public Builder setAscentTime(final Double value) {
            setFieldByNumber(16, value);
            return this;
        }

        public Builder setAvgAscentRate(final Double value) {
            setFieldByNumber(17, value);
            return this;
        }

        public Builder setAvgDescentRate(final Double value) {
            setFieldByNumber(22, value);
            return this;
        }

        public Builder setMaxAscentRate(final Double value) {
            setFieldByNumber(23, value);
            return this;
        }

        public Builder setMaxDescentRate(final Double value) {
            setFieldByNumber(24, value);
            return this;
        }

        public Builder setHangTime(final Double value) {
            setFieldByNumber(25, value);
            return this;
        }

        public Builder setTimestamp(final Long value) {
            setFieldByNumber(253, value);
            return this;
        }

        @Override
        public FitDiveSummary build() {
            return (FitDiveSummary) super.build();
        }

        @Override
        public FitDiveSummary build(final int localMessageType) {
            return (FitDiveSummary) super.build(localMessageType);
        }
    }
}
