package thresholds

import (
	"strconv"
	"strings"
)

const AtaSmartAttributeDisplayTypeRaw = "raw"
const AtaSmartAttributeDisplayTypeNormalized = "normalized"
const AtaSmartAttributeDisplayTypeTransformed = "transformed"

type AtaAttributeMetadata struct {
	ID          int64  `json:"-"`
	DisplayName string `json:"display_name"`
	Ideal       string `json:"ideal"`
	Critical    bool   `json:"critical"`
	Description string `json:"description"`

	Transform          func(int64, int64, string) int64 `json:"-"` //this should be a method to extract/tranform the normalized or raw data to a chartable format. Str
	TransformValueUnit string                           `json:"transform_value_unit,omitempty"`
	ObservedThresholds []ObservedThreshold              `json:"observed_thresholds,omitempty"` //these thresholds must match the DisplayType
	DisplayType        string                           `json:"display_type"`                  //"raw" "normalized" or "transformed"
}

const ObservedThresholdIdealLow = "low"
const ObservedThresholdIdealHigh = "high"

type ObservedThreshold struct {
	Low  int64 `json:"low"`  //threshold (row/normalized data) boundary low value
	High int64 `json:"high"` //threshold (row/normalized data) boundary high value

	AnnualFailureRate float64   `json:"annual_failure_rate"` //error rate %
	ErrorInterval     []float64 `json:"error_interval"`
}

var AtaMetadata = map[int]AtaAttributeMetadata{
	1: {
		ID:          1,
		DisplayName: "Read Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "(Vendor specific raw value.) Stores data related to the rate of hardware read errors that occurred when reading data from a disk surface. The raw value has different structure for different vendors and is often not meaningful as a decimal number.",
	},
	2: {
		ID:          2,
		DisplayName: "Throughput Performance",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealHigh,
		Critical:    false,
		Description: "Overall (general) throughput performance of a hard disk drive. If the value of this attribute is decreasing there is a high probability that there is a problem with the disk.",
	},
	3: {
		ID:          3,
		DisplayName: "Spin-Up Time",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Average time of spindle spin up (from zero RPM to fully operational [milliseconds]).",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               78,
				High:              96,
				AnnualFailureRate: 0.11452195377351217,
				ErrorInterval:     []float64{0.10591837762295722, 0.12363823501915781},
			},
			{
				Low:               96,
				High:              114,
				AnnualFailureRate: 0.040274562840558074,
				ErrorInterval:     []float64{0.03465055611002801, 0.046551312468303144},
			},
			{
				Low:               114,
				High:              132,
				AnnualFailureRate: 0.009100406705780476,
				ErrorInterval:     []float64{0.006530608971356785, 0.012345729280075591},
			},
			{
				Low:               132,
				High:              150,
				AnnualFailureRate: 0.008561351734020232,
				ErrorInterval:     []float64{0.004273795939256936, 0.015318623141355509},
			},
			{
				Low:               150,
				High:              168,
				AnnualFailureRate: 0.015780508262068848,
				ErrorInterval:     []float64{0.005123888078524015, 0.03682644215646287},
			},
			{
				Low:               168,
				High:              186,
				AnnualFailureRate: 0.05262688124794024,
				ErrorInterval:     []float64{0.0325768689524594, 0.08044577830285578},
			},
			{
				Low:               186,
				High:              204,
				AnnualFailureRate: 0.01957419424036038,
				ErrorInterval:     []float64{0.0023705257325185624, 0.0707087198669825},
			},
			{
				Low:               204,
				High:              222,
				AnnualFailureRate: 0.026050959960031404,
				ErrorInterval:     []float64{0.0006595532020744994, 0.1451466588889228},
			},
		},
	},
	4: {
		ID:          4,
		DisplayName: "Start/Stop Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       "",
		Critical:    false,
		Description: "A tally of spindle start/stop cycles. The spindle turns on, and hence the count is increased, both when the hard disk is turned on after having before been turned entirely off (disconnected from power source) and when the hard disk returns from having previously been put to sleep mode.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              13,
				AnnualFailureRate: 0.01989335424860646,
				ErrorInterval:     []float64{0.016596548909440657, 0.023653263230617408},
			},
			{
				Low:               13,
				High:              26,
				AnnualFailureRate: 0.03776935438256488,
				ErrorInterval:     []float64{0.03310396052098642, 0.04290806173460437},
			},
			{
				Low:               26,
				High:              39,
				AnnualFailureRate: 0.11022223828187004,
				ErrorInterval:     []float64{0.09655110535164119, 0.12528657238811672},
			},
			{
				Low:               39,
				High:              52,
				AnnualFailureRate: 0.16289995457762474,
				ErrorInterval:     []float64{0.13926541653588131, 0.18939614504497515},
			},
			{
				Low:               52,
				High:              65,
				AnnualFailureRate: 0.19358212432279714,
				ErrorInterval:     []float64{0.15864522253849073, 0.23392418181765526},
			},
			{
				Low:               65,
				High:              78,
				AnnualFailureRate: 0.1157094940074447,
				ErrorInterval:     []float64{0.07861898732346269, 0.16424039052527728},
			},
			{
				Low:               78,
				High:              91,
				AnnualFailureRate: 0.12262136155304391,
				ErrorInterval:     []float64{0.0670382394080032, 0.20573780888032978},
			},
			{
				Low:               91,
				High:              104,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
		},
	},
	5: {
		ID:          5,
		DisplayName: "Reallocated Sectors Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "Count of reallocated sectors. The raw value represents a count of the bad sectors that have been found and remapped.Thus, the higher the attribute value, the more sectors the drive has had to reallocate. This value is primarily used as a metric of the life expectancy of the drive; a drive which has had any reallocations at all is significantly more likely to fail in the immediate months.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.025169175350572493,
				ErrorInterval:     []float64{0.022768612038746357, 0.027753988579272894},
			},
			{
				Low:               1,
				High:              4,
				AnnualFailureRate: 0.027432608477803388,
				ErrorInterval:     []float64{0.010067283827589948, 0.05970923963096652},
			},
			{
				Low:               4,
				High:              16,
				AnnualFailureRate: 0.07501976284584981,
				ErrorInterval:     []float64{0.039944864177334186, 0.12828607921150972},
			},
			{
				Low:               16,
				High:              70,
				AnnualFailureRate: 0.23589260654405794,
				ErrorInterval:     []float64{0.1643078435800227, 0.32806951196017664},
			},
			{
				Low:               70,
				High:              260,
				AnnualFailureRate: 0.36193219378600433,
				ErrorInterval:     []float64{0.2608488901774093, 0.4892271827875412},
			},
			{
				Low:               260,
				High:              1100,
				AnnualFailureRate: 0.5676621428968173,
				ErrorInterval:     []float64{0.4527895568499355, 0.702804359408436},
			},
			{
				Low:               1100,
				High:              4500,
				AnnualFailureRate: 1.5028253400346423,
				ErrorInterval:     []float64{1.2681757596263297, 1.768305221795894},
			},
			{
				Low:               4500,
				High:              17000,
				AnnualFailureRate: 2.0659987547404763,
				ErrorInterval:     []float64{1.6809790460512237, 2.512808045182302},
			},
			{
				Low:               17000,
				High:              70000,
				AnnualFailureRate: 1.7755385684503124,
				ErrorInterval:     []float64{1.2796520259849835, 2.400012341226441},
			},
		},
	},
	6: {
		ID:          6,
		DisplayName: "Read Channel Margin",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Margin of a channel while reading data. The function of this attribute is not specified.",
	},
	7: {
		ID:          7,
		DisplayName: "Seek Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "(Vendor specific raw value.) Rate of seek errors of the magnetic heads. If there is a partial failure in the mechanical positioning system, then seek errors will arise. Such a failure may be due to numerous factors, such as damage to a servo, or thermal widening of the hard disk. The raw value has different structure for different vendors and is often not meaningful as a decimal number.",
	},
	8: {
		ID:          8,
		DisplayName: "Seek Time Performance",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealHigh,
		Critical:    false,
		Description: "Average performance of seek operations of the magnetic heads. If this attribute is decreasing, it is a sign of problems in the mechanical subsystem.",
	},
	9: {

		ID:          9,
		DisplayName: "Power-On Hours",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Count of hours in power-on state. The raw value of this attribute shows total count of hours (or minutes, or seconds, depending on manufacturer) in power-on state. By default, the total expected lifetime of a hard disk in perfect condition is defined as 5 years (running every day and night on all days). This is equal to 1825 days in 24/7 mode or 43800 hours. On some pre-2005 drives, this raw value may advance erratically and/or \"wrap around\" (reset to zero periodically).",
	},
	10: {
		ID:          10,
		DisplayName: "Spin Retry Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "Count of retry of spin start attempts. This attribute stores a total count of the spin start attempts to reach the fully operational speed (under the condition that the first attempt was unsuccessful). An increase of this attribute value is a sign of problems in the hard disk mechanical subsystem.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.05459827163896099,
				ErrorInterval:     []float64{0.05113785787727033, 0.05823122757702782},
			},
			{ //TODO: using fake data from attribute 11. Not enough data, but critical and correlated with failure.
				Low:               0,
				High:              80,
				AnnualFailureRate: 0.5555555555555556,
				ErrorInterval:     []float64{0.014065448880161053, 3.095357439410498},
			},
		},
	},
	11: {
		ID:          11,
		DisplayName: "Recalibration Retries or Calibration Retry Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "This attribute indicates the count that recalibration was requested (under the condition that the first attempt was unsuccessful). An increase of this attribute value is a sign of problems in the hard disk mechanical subsystem.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.04658866433672694,
				ErrorInterval:     []float64{0.03357701137320878, 0.06297433993055492},
			},
			{
				Low:               0,
				High:              80,
				AnnualFailureRate: 0.5555555555555556,
				ErrorInterval:     []float64{0.014065448880161053, 3.095357439410498},
			},
			{
				Low:               80,
				High:              160,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               160,
				High:              240,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               240,
				High:              320,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               320,
				High:              400,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               400,
				High:              480,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               480,
				High:              560,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
		},
	},
	12: {
		ID:          12,
		DisplayName: "Power Cycle Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "This attribute indicates the count of full hard disk power on/off cycles.",
	},
	13: {
		ID:          13,
		DisplayName: "Soft Read Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Uncorrected read errors reported to the operating system.",
	},
	22: {
		ID:          22,
		DisplayName: "Current Helium Level",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealHigh,
		Critical:    false,
		Description: "Specific to He8 drives from HGST. This value measures the helium inside of the drive specific to this manufacturer. It is a pre-fail attribute that trips once the drive detects that the internal environment is out of specification.",
	},
	170: {
		ID:          170,
		DisplayName: "Available Reserved Space",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "See attribute E8.",
	},
	171: {
		ID:          171,
		DisplayName: "SSD Program Fail Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "(Kingston) The total number of flash program operation failures since the drive was deployed.[33] Identical to attribute 181.",
	},
	172: {
		ID:          172,
		DisplayName: "SSD Erase Fail Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "(Kingston) Counts the number of flash erase failures. This attribute returns the total number of Flash erase operation failures since the drive was deployed. This attribute is identical to attribute 182.",
	},
	173: {
		ID:          173,
		DisplayName: "SSD Wear Leveling Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Counts the maximum worst erase count on any block.",
	},
	174: {
		ID:          174,
		DisplayName: "Unexpected Power Loss Count",
		Ideal:       "",
		Critical:    false,
		Description: "Also known as \"Power-off Retract Count\" per conventional HDD terminology. Raw value reports the number of unclean shutdowns, cumulative over the life of an SSD, where an \"unclean shutdown\" is the removal of power without STANDBY IMMEDIATE as the last command (regardless of PLI activity using capacitor power). Normalized value is always 100.",
	},
	175: {
		ID:          175,
		DisplayName: "Power Loss Protection Failure",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Last test result as microseconds to discharge cap, saturated at its maximum value. Also logs minutes since last test and lifetime number of tests. Raw value contains the following data:     Bytes 0-1: Last test result as microseconds to discharge cap, saturates at max value. Test result expected in range 25 <= result <= 5000000, lower indicates specific error code. Bytes 2-3: Minutes since last test, saturates at max value.Bytes 4-5: Lifetime number of tests, not incremented on power cycle, saturates at max value. Normalized value is set to one on test failure or 11 if the capacitor has been tested in an excessive temperature condition, otherwise 100.",
	},
	176: {
		ID:          176,
		DisplayName: "Erase Fail Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "S.M.A.R.T. parameter indicates a number of flash erase command failures.",
	},
	177: {
		ID:          177,
		DisplayName: "Wear Range Delta",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Delta between most-worn and least-worn Flash blocks. It describes how good/bad the wearleveling of the SSD works on a more technical way. ",
	},
	179: {
		ID:          179,
		DisplayName: "Used Reserved Block Count Total",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Pre-Fail attribute used at least in Samsung devices.",
	},
	180: {
		ID:          180,
		DisplayName: "Unused Reserved Block Count Total",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "\"Pre-Fail\" attribute used at least in HP devices. ",
	},
	181: {
		ID:          181,
		DisplayName: "Program Fail Count Total",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Total number of Flash program operation failures since the drive was deployed.",
	},
	182: {
		ID:          182,
		DisplayName: "Erase Fail Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "\"Pre-Fail\" Attribute used at least in Samsung devices.",
	},
	183: {
		ID:          183,
		DisplayName: "SATA Downshift Error Count or Runtime Bad Block",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Western Digital, Samsung or Seagate attribute: Either the number of downshifts of link speed (e.g. from 6Gbit/s to 3Gbit/s) or the total number of data blocks with detected, uncorrectable errors encountered during normal operation. Although degradation of this parameter can be an indicator of drive aging and/or potential electromechanical problems, it does not directly indicate imminent drive failure.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.09084549203210031,
				ErrorInterval:     []float64{0.08344373475686712, 0.09872777224842152},
			},
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.05756065656498585,
				ErrorInterval:     []float64{0.04657000847949464, 0.07036491775108872},
			},
			{
				Low:               2,
				High:              4,
				AnnualFailureRate: 0.6193088626208925,
				ErrorInterval:     []float64{0.41784508895529787, 0.8841019099092139},
			},
			{
				Low:               4,
				High:              8,
				AnnualFailureRate: 0.5533447034299792,
				ErrorInterval:     []float64{0.31628430884775033, 0.8985971312402635},
			},
			{
				Low:               8,
				High:              16,
				AnnualFailureRate: 0.3882388694727245,
				ErrorInterval:     []float64{0.21225380267814295, 0.6513988534774338},
			},
			{
				Low:               16,
				High:              35,
				AnnualFailureRate: 0.37116708385481856,
				ErrorInterval:     []float64{0.19763084005134446, 0.6347070173754686},
			},
			{
				Low:               35,
				High:              70,
				AnnualFailureRate: 0.2561146752205292,
				ErrorInterval:     []float64{0.10297138269895259, 0.5276941165819332},
			},
			{
				Low:               70,
				High:              130,
				AnnualFailureRate: 0.40299684542586756,
				ErrorInterval:     []float64{0.16202563309223209, 0.8303275247667772},
			},
			{
				Low:               130,
				High:              260,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
		},
	},
	184: {
		ID:          184,
		DisplayName: "End-to-End error",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "This attribute is a part of Hewlett-Packard\"s SMART IV technology, as well as part of other vendors\" IO Error Detection and Correction schemas, and it contains a count of parity errors which occur in the data path to the media via the drive\"s cache RAM",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               93,
				High:              94,
				AnnualFailureRate: 1.631212012870933,
				ErrorInterval:     []float64{1.055634407303844, 2.407990716767714},
			},
			{
				Low:               94,
				High:              95,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               95,
				High:              96,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               96,
				High:              97,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               97,
				High:              97,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               97,
				High:              98,
				AnnualFailureRate: 1.8069306930693072,
				ErrorInterval:     []float64{0.04574752432804858, 10.067573453924245},
			},
			{
				Low:               98,
				High:              99,
				AnnualFailureRate: 0.8371559633027523,
				ErrorInterval:     []float64{0.10138347095016888, 3.0240951820174824},
			},
			{
				Low:               99,
				High:              100,
				AnnualFailureRate: 0.09334816849865138,
				ErrorInterval:     []float64{0.08689499010435861, 0.10015372448181788},
			},
		},
	},
	185: {
		ID:          185,
		DisplayName: "Head Stability",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Western Digital attribute.",
	},
	186: {
		ID:          186,
		DisplayName: "Induced Op-Vibration Detection",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Western Digital attribute.",
	},
	187: {
		ID:          187,
		DisplayName: "Reported Uncorrectable Errors",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "The count of errors that could not be recovered using hardware ECC (see attribute 195).",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.028130798308190524,
				ErrorInterval:     []float64{0.024487830609364304, 0.032162944988161336},
			},
			{
				Low:               1,
				High:              1,
				AnnualFailureRate: 0.33877621175661743,
				ErrorInterval:     []float64{0.22325565823630591, 0.4929016016666955},
			},
			{
				Low:               1,
				High:              3,
				AnnualFailureRate: 0.24064820598237213,
				ErrorInterval:     []float64{0.14488594021076606, 0.3758019832614595},
			},
			{
				Low:               3,
				High:              6,
				AnnualFailureRate: 0.5014425058387142,
				ErrorInterval:     []float64{0.3062941096766342, 0.7744372808405151},
			},
			{
				Low:               6,
				High:              11,
				AnnualFailureRate: 0.38007108544136836,
				ErrorInterval:     []float64{0.2989500188963677, 0.4764223967570595},
			},
			{
				Low:               11,
				High:              20,
				AnnualFailureRate: 0.5346094598348444,
				ErrorInterval:     []float64{0.40595137663302483, 0.6911066985735377},
			},
			{
				Low:               20,
				High:              35,
				AnnualFailureRate: 0.8428063943161636,
				ErrorInterval:     []float64{0.6504601819243522, 1.0742259350903411},
			},
			{
				Low:               35,
				High:              65,
				AnnualFailureRate: 1.4429071005017484,
				ErrorInterval:     []float64{1.1405581860945952, 1.8008133631629157},
			},
			{
				Low:               65,
				High:              120,
				AnnualFailureRate: 1.6190935390549661,
				ErrorInterval:     []float64{1.0263664163011208, 2.4294352761068576},
			},
		},
	},
	188: {
		ID:          188,
		DisplayName: "Command Timeout",
		DisplayType: AtaSmartAttributeDisplayTypeTransformed,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "The count of aborted operations due to HDD timeout. Normally this attribute value should be equal to zero.",
		Transform: func(normValue int64, rawValue int64, rawString string) int64 {
			// Parse Seagate command timeout values if the string contains 3 pieces
			// and each piece is less than or equal to the next (as a sanity check)
			// See https://github.com/AnalogJ/scrutiny/issues/522
			pieces := strings.Split(rawString, " ")
			if len(pieces) == 3 {
				int_pieces := make([]int, len(pieces))
				var err error
				for i, s := range pieces {
					int_pieces[i], err = strconv.Atoi(s)
					if err != nil {
						return rawValue
					}
				}
				if int_pieces[2] >= int_pieces[1] && int_pieces[1] >= int_pieces[0] {
					return int64(int_pieces[2])
				}
			}
			return rawValue
		},
		ObservedThresholds: []ObservedThreshold{
			{
				Low: 0,
				// This is set arbitrarily to avoid notifications caused by low
				// historical numbers of command timeouts (e.g. caused by a bad cable)
				High:              100,
				AnnualFailureRate: 0.024893587674442153,
				ErrorInterval:     []float64{0.020857343769186413, 0.0294830350167543},
			},
			{
				Low:               100,
				High:              13000000000,
				AnnualFailureRate: 0.10044174089362015,
				ErrorInterval:     []float64{0.0812633664077498, 0.1227848196758574},
			},
			{
				Low:               13000000000,
				High:              26000000000,
				AnnualFailureRate: 0.334030592234279,
				ErrorInterval:     []float64{0.2523231196342665, 0.4337665082489293},
			},
			{
				Low:               26000000000,
				High:              39000000000,
				AnnualFailureRate: 0.36724705400842445,
				ErrorInterval:     []float64{0.30398009356575617, 0.4397986538328568},
			},
			{
				Low:               39000000000,
				High:              52000000000,
				AnnualFailureRate: 0.29848155926978354,
				ErrorInterval:     []float64{0.2509254838615984, 0.35242890006477073},
			},
			{
				Low:               52000000000,
				High:              65000000000,
				AnnualFailureRate: 0.2203079701535098,
				ErrorInterval:     []float64{0.18366082845676174, 0.26212468677179274},
			},
			{
				Low:               65000000000,
				High:              78000000000,
				AnnualFailureRate: 0.3018169948863018,
				ErrorInterval:     []float64{0.23779746376787655, 0.37776897542831006},
			},
			{
				Low:               78000000000,
				High:              91000000000,
				AnnualFailureRate: 0.32854928239235887,
				ErrorInterval:     []float64{0.2301118782147336, 0.4548506948185028},
			},
			{
				Low:               91000000000,
				High:              104000000000,
				AnnualFailureRate: 0.28488916640649387,
				ErrorInterval:     []float64{0.1366154288236293, 0.5239213202729072},
			},
		},
	},
	189: {
		ID:          189,
		DisplayName: "High Fly Writes",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "HDD manufacturers implement a flying height sensor that attempts to provide additional protections for write operations by detecting when a recording head is flying outside its normal operating range. If an unsafe fly height condition is encountered, the write process is stopped, and the information is rewritten or reallocated to a safe region of the hard drive. This attribute indicates the count of these errors detected over the lifetime of the drive.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.09070551401946862,
				ErrorInterval:     []float64{0.08018892683853401, 0.10221801211956287},
			},
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.0844336097370013,
				ErrorInterval:     []float64{0.07299813695315267, 0.09715235540340669},
			},
			{
				Low:               2,
				High:              5,
				AnnualFailureRate: 0.07943219628781906,
				ErrorInterval:     []float64{0.06552176680630226, 0.09542233189887633},
			},
			{
				Low:               5,
				High:              13,
				AnnualFailureRate: 0.09208847603893404,
				ErrorInterval:     []float64{0.07385765060838133, 0.11345557807163456},
			},
			{
				Low:               13,
				High:              30,
				AnnualFailureRate: 0.18161161650924224,
				ErrorInterval:     []float64{0.13858879602902988, 0.23377015012749933},
			},
			{
				Low:               30,
				High:              70,
				AnnualFailureRate: 0.2678117886102384,
				ErrorInterval:     []float64{0.19044036194841887, 0.36610753129699186},
			},
			{
				Low:               70,
				High:              150,
				AnnualFailureRate: 0.26126480798826107,
				ErrorInterval:     []float64{0.15958733218826962, 0.4035023060905559},
			},
			{
				Low:               150,
				High:              350,
				AnnualFailureRate: 0.11337164155924832,
				ErrorInterval:     []float64{0.030889956621649995, 0.2902764300762812},
			},
		},
	},
	190: {
		ID:          190,
		DisplayName: "Temperature Difference",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Value is equal to (100-temp. °C), allowing manufacturer to set a minimum threshold which corresponds to a maximum temperature. This also follows the convention of 100 being a best-case value and lower values being undesirable. However, some older drives may instead report raw Temperature (identical to 0xC2) or Temperature minus 50 here.",
	},
	191: {
		ID:          191,
		DisplayName: "G-sense Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "The count of errors resulting from externally induced shock and vibration. ",
	},
	192: {
		ID:          192,
		DisplayName: "Power-off Retract Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Number of power-off or emergency retract cycles.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.02861098445412803,
				ErrorInterval:     []float64{0.022345416230915037, 0.036088863823297186},
			},
			{
				Low:               2,
				High:              6,
				AnnualFailureRate: 0.0738571777154862,
				ErrorInterval:     []float64{0.06406927746420421, 0.0847175264009771},
			},
			{
				Low:               6,
				High:              16,
				AnnualFailureRate: 0.11970378206823593,
				ErrorInterval:     []float64{0.10830059875098269, 0.13198105985656441},
			},
			{
				Low:               16,
				High:              40,
				AnnualFailureRate: 0.027266868552620425,
				ErrorInterval:     []float64{0.021131448605713823, 0.03462795920968522},
			},
			{
				Low:               40,
				High:              100,
				AnnualFailureRate: 0.011741682974559688,
				ErrorInterval:     []float64{0.00430899071133239, 0.025556700631152028},
			},
			{
				Low:               100,
				High:              250,
				AnnualFailureRate: 0.012659940134091309,
				ErrorInterval:     []float64{0.00607093338127348, 0.023282080653656938},
			},
			{
				Low:               250,
				High:              650,
				AnnualFailureRate: 0.01634692899031039,
				ErrorInterval:     []float64{0.009522688540043157, 0.026173016865409605},
			},
			{
				Low:               650,
				High:              1600,
				AnnualFailureRate: 0.005190074354440066,
				ErrorInterval:     []float64{0.0025908664180103293, 0.009286476666453648},
			},
		},
	},
	193: {
		ID:          193,
		DisplayName: "Load Cycle Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of load/unload cycles into head landing zone position.[45] Some drives use 225 (0xE1) for Load Cycle Count instead.",
	},
	194: {
		ID:          194,
		DisplayName: "Temperature",
		DisplayType: AtaSmartAttributeDisplayTypeTransformed,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Indicates the device temperature, if the appropriate sensor is fitted. Lowest byte of the raw value contains the exact temperature value (Celsius degrees).",
		Transform: func(normValue int64, rawValue int64, rawString string) int64 {
			return rawValue & 0b11111111
		},
		TransformValueUnit: "°C",
	},
	195: {
		ID:          195,
		DisplayName: "Hardware ECC Recovered",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "(Vendor-specific raw value.) The raw value has different structure for different vendors and is often not meaningful as a decimal number.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               12,
				High:              24,
				AnnualFailureRate: 0.31472916829975706,
				ErrorInterval:     []float64{0.15711166685282174, 0.5631374192486645},
			},
			{
				Low:               24,
				High:              36,
				AnnualFailureRate: 0.15250310197260136,
				ErrorInterval:     []float64{0.10497611828070175, 0.21417105521823687},
			},
			{
				Low:               36,
				High:              48,
				AnnualFailureRate: 0.2193119102723874,
				ErrorInterval:     []float64{0.16475385681835103, 0.28615447006525274},
			},
			{
				Low:               48,
				High:              60,
				AnnualFailureRate: 0.05672658497265746,
				ErrorInterval:     []float64{0.043182904776447234, 0.07317316161437043},
			},
			{
				Low:               60,
				High:              72,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               72,
				High:              84,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               84,
				High:              96,
				AnnualFailureRate: 0,
				ErrorInterval:     []float64{0, 0},
			},
			{
				Low:               96,
				High:              108,
				AnnualFailureRate: 0.04074570216566197,
				ErrorInterval:     []float64{0.001031591863615295, 0.22702052218047528},
			},
		},
	},
	196: {
		ID:          196,
		DisplayName: "Reallocation Event Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "Count of remap operations. The raw value of this attribute shows the total count of attempts to transfer data from reallocated sectors to a spare area. Both successful and unsuccessful attempts are counted.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.007389855800729792,
				ErrorInterval:     []float64{0.005652654139732716, 0.009492578928212054},
			},
			{
				Low:               1,
				High:              1,
				AnnualFailureRate: 0.026558331312151347,
				ErrorInterval:     []float64{0.005476966404484466, 0.07761471429677293},
			},
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.02471894893674658,
				ErrorInterval:     []float64{0.0006258296027540169, 0.13772516847438018},
			},
			{
				Low:               2,
				High:              4,
				AnnualFailureRate: 0.03200912040691046,
				ErrorInterval:     []float64{0.0008104007642081744, 0.17834340416493005},
			},
			{
				Low:               4,
				High:              7,
				AnnualFailureRate: 0.043078012510326925,
				ErrorInterval:     []float64{0.001090640849081295, 0.24001532369794615},
			},
			{
				Low:               7,
				High:              11,
				AnnualFailureRate: 0.033843300880853036,
				ErrorInterval:     []float64{0.0008568381932559863, 0.18856280368036135},
			},
			{
				Low:               11,
				High:              17,
				AnnualFailureRate: 0.16979376647542252,
				ErrorInterval:     []float64{0.035015556653263225, 0.49620943874336304},
			},
			{
				Low:               17,
				High:              27,
				AnnualFailureRate: 0.059042381106438044,
				ErrorInterval:     []float64{0.0014948236677880642, 0.32896309247698113},
			},
			{
				Low:               27,
				High:              45,
				AnnualFailureRate: 0.24701105346266636,
				ErrorInterval:     []float64{0.050939617608142244, 0.721871118983972},
			},
		},
	},
	197: {
		ID:          197,
		DisplayName: "Current Pending Sector Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "Count of \"unstable\" sectors (waiting to be remapped, because of unrecoverable read errors). If an unstable sector is subsequently read successfully, the sector is remapped and this value is decreased. Read errors on a sector will not remap the sector immediately (since the correct value cannot be read and so the value to remap is not known, and also it might become readable later); instead, the drive firmware remembers that the sector needs to be remapped, and will remap it the next time it\"s written.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.025540791394761345,
				ErrorInterval:     []float64{0.023161777231213983, 0.02809784482748174},
			},
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.34196613799103254,
				ErrorInterval:     []float64{0.22723401523750225, 0.4942362818474496},
			},
			{
				Low:               2,
				High:              6,
				AnnualFailureRate: 0.6823772508117681,
				ErrorInterval:     []float64{0.41083568090070416, 1.0656166047061635},
			},
			{
				Low:               6,
				High:              16,
				AnnualFailureRate: 0.6108100007493069,
				ErrorInterval:     []float64{0.47336936083368364, 0.7757071095273286},
			},
			{
				Low:               16,
				High:              40,
				AnnualFailureRate: 0.9564879341127684,
				ErrorInterval:     []float64{0.7701044196378299, 1.174355230793638},
			},
			{
				Low:               40,
				High:              100,
				AnnualFailureRate: 1.6519989942167461,
				ErrorInterval:     []float64{1.328402276482456, 2.0305872327541317},
			},
			{
				Low:               100,
				High:              250,
				AnnualFailureRate: 2.5137741046831956,
				ErrorInterval:     []float64{1.9772427971560862, 3.1510376077891613},
			},
			{
				Low:               250,
				High:              650,
				AnnualFailureRate: 3.3203378817413904,
				ErrorInterval:     []float64{2.5883662702274406, 4.195047163573006},
			},
			{
				Low:               650,
				High:              1600,
				AnnualFailureRate: 3.133047210300429,
				ErrorInterval:     []float64{1.1497731080460096, 6.819324775707182},
			},
		},
	},
	198: {
		ID:          198,
		DisplayName: "(Offline) Uncorrectable Sector Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "The total count of uncorrectable errors when reading/writing a sector. A rise in the value of this attribute indicates defects of the disk surface and/or problems in the mechanical subsystem.",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              0,
				AnnualFailureRate: 0.028675322159886437,
				ErrorInterval:     []float64{0.026159385510707116, 0.03136793218577656},
			},
			{
				Low:               0,
				High:              2,
				AnnualFailureRate: 0.8135764944275583,
				ErrorInterval:     []float64{0.40613445471964466, 1.4557130815309443},
			},
			{
				Low:               2,
				High:              4,
				AnnualFailureRate: 1.1173469387755102,
				ErrorInterval:     []float64{0.5773494680315332, 1.9517802404552516},
			},
			{
				Low:               4,
				High:              6,
				AnnualFailureRate: 1.3558692421991083,
				ErrorInterval:     []float64{0.4402470522980859, 3.1641465148237544},
			},
			{
				Low:               6,
				High:              8,
				AnnualFailureRate: 0.7324414715719062,
				ErrorInterval:     []float64{0.15104704003805655, 2.140504796291604},
			},
			{
				Low:               8,
				High:              10,
				AnnualFailureRate: 0.5777213677766163,
				ErrorInterval:     []float64{0.43275294849366835, 0.7556737733062419},
			},
			{
				Low:               10,
				High:              12,
				AnnualFailureRate: 1.7464114832535886,
				ErrorInterval:     []float64{0.47583835092536914, 4.471507017371231},
			},
			{
				Low:               12,
				High:              14,
				AnnualFailureRate: 2.6449275362318843,
				ErrorInterval:     []float64{0.3203129951758959, 9.554387676519005},
			},
			{
				Low:               14,
				High:              16,
				AnnualFailureRate: 0.796943231441048,
				ErrorInterval:     []float64{0.5519063550198366, 1.113648286331181},
			},
		},
	},
	199: {
		ID:          199,
		DisplayName: "UltraDMA CRC Error Count",
		DisplayType: AtaSmartAttributeDisplayTypeRaw,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "The count of errors in data transfer via the interface cable as determined by ICRC (Interface Cyclic Redundancy Check).",
		ObservedThresholds: []ObservedThreshold{
			{
				Low:               0,
				High:              1,
				AnnualFailureRate: 0.04068379316116366,
				ErrorInterval:     []float64{0.037534031558106425, 0.04402730201866553},
			},
			{
				Low:               1,
				High:              2,
				AnnualFailureRate: 0.1513481259734218,
				ErrorInterval:     []float64{0.12037165605991791, 0.18786293065527596},
			},
			{
				Low:               2,
				High:              4,
				AnnualFailureRate: 0.16849758722418978,
				ErrorInterval:     []float64{0.12976367397863445, 0.2151676572000481},
			},
			{
				Low:               4,
				High:              8,
				AnnualFailureRate: 0.15385127340491614,
				ErrorInterval:     []float64{0.10887431782430312, 0.21117289306426648},
			},
			{
				Low:               8,
				High:              16,
				AnnualFailureRate: 0.14882894050104387,
				ErrorInterval:     []float64{0.09631424312463635, 0.2197008753522735},
			},
			{
				Low:               16,
				High:              35,
				AnnualFailureRate: 0.20878219917249793,
				ErrorInterval:     []float64{0.14086447304552446, 0.29804957135975},
			},
			{
				Low:               35,
				High:              70,
				AnnualFailureRate: 0.13742940270409038,
				ErrorInterval:     []float64{0.06860426267470295, 0.24589916335290812},
			},
			{
				Low:               70,
				High:              130,
				AnnualFailureRate: 0.22336578581363,
				ErrorInterval:     []float64{0.11150339549604707, 0.39966309081252904},
			},
			{
				Low:               130,
				High:              260,
				AnnualFailureRate: 0.18277416124186283,
				ErrorInterval:     []float64{0.07890890989692058, 0.3601379610272007},
			},
		},
	},
	200: {
		ID:          200,
		DisplayName: "Multi-Zone Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "The count of errors found when writing a sector. The higher the value, the worse the disk\"s mechanical condition is.",
	},
	201: {
		ID:          201,
		DisplayName: "Soft Read Error Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    true,
		Description: "Count indicates the number of uncorrectable software read errors.",
	},
	202: {
		ID:          202,
		DisplayName: "Data Address Mark errors",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of Data Address Mark errors (or vendor-specific).",
	},
	203: {
		ID:          203,
		DisplayName: "Run Out Cancel",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "The number of errors caused by incorrect checksum during the error correction.",
	},
	204: {
		ID:          204,
		DisplayName: "Soft ECC Correction",
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of errors corrected by the internal error correction software.",
	},
	205: {
		ID:          205,
		DisplayName: "Thermal Asperity Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of errors due to high temperature.",
	},
	206: {
		ID:          206,
		DisplayName: "Flying Height",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Height of heads above the disk surface. If too low, head crash is more likely; if too high, read/write errors are more likely.",
	},
	207: {
		ID:          207,
		DisplayName: "Spin High Current",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Amount of surge current used to spin up the drive.",
	},
	208: {
		ID:          208,
		DisplayName: "Spin Buzz",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Count of buzz routines needed to spin up the drive due to insufficient power.",
	},
	209: {
		ID:          209,
		DisplayName: "Offline Seek Performance",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Drive\"s seek performance during its internal tests.",
	},
	210: {
		ID:          210,
		DisplayName: "Vibration During Write",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Found in Maxtor 6B200M0 200GB and Maxtor 2R015H1 15GB disks.",
	},
	211: {
		ID:          211,
		DisplayName: "Vibration During Write",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "A recording of a vibration encountered during write operations.",
	},
	212: {
		ID:          212,
		DisplayName: "Shock During Write",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "A recording of shock encountered during write operations.",
	},
	220: {
		ID:          220,
		DisplayName: "Disk Shift",
		Ideal:       ObservedThresholdIdealLow,
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Critical:    false,
		Description: "Distance the disk has shifted relative to the spindle (usually due to shock or temperature). Unit of measure is unknown.",
	},
	221: {
		ID:          221,
		DisplayName: "G-Sense Error Rate",
		Ideal:       ObservedThresholdIdealLow,
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Critical:    false,
		Description: "The count of errors resulting from externally induced shock and vibration.",
	},
	222: {
		ID:          222,
		DisplayName: "Loaded Hours",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Time spent operating under data load (movement of magnetic head armature).",
	},
	223: {
		ID:          223,
		DisplayName: "Load/Unload Retry Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Count of times head changes position.",
	},
	224: {
		ID:          224,
		DisplayName: "Load Friction",
		Ideal:       ObservedThresholdIdealLow,
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Critical:    false,
		Description: "Resistance caused by friction in mechanical parts while operating.",
	},
	225: {
		ID:          225,
		DisplayName: "Load/Unload Cycle Count",
		Ideal:       ObservedThresholdIdealLow,
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Critical:    false,
		Description: "Total count of load cycles Some drives use 193 (0xC1) for Load Cycle Count instead. See Description for 193 for significance of this number. ",
	},
	226: {
		ID:          226,
		DisplayName: "Load \"In\"-time",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Total time of loading on the magnetic heads actuator (time not spent in parking area).",
	},
	227: {
		ID:          227,
		DisplayName: "Torque Amplification Count",
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of attempts to compensate for platter speed variations.[66]",
	},
	228: {
		ID:          228,
		DisplayName: "Power-Off Retract Cycle",
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "The number of power-off cycles which are counted whenever there is a \"retract event\" and the heads are loaded off of the media such as when the machine is powered down, put to sleep, or is idle.",
	},
	230: {
		ID:          230,
		DisplayName: "GMR Head Amplitude ",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Amplitude of \"thrashing\" (repetitive head moving motions between operations).",
	},
	231: {
		ID:          231,
		DisplayName: "Life Left",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Indicates the approximate SSD life left, in terms of program/erase cycles or available reserved blocks. A normalized value of 100 represents a new drive, with a threshold value at 10 indicating a need for replacement. A value of 0 may mean that the drive is operating in read-only mode to allow data recovery.",
	},
	232: {
		ID:          232,
		DisplayName: "Endurance Remaining",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Number of physical erase cycles completed on the SSD as a percentage of the maximum physical erase cycles the drive is designed to endure.",
	},
	233: {
		ID:          233,
		DisplayName: "Media Wearout Indicator",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Intel SSDs report a normalized value from 100, a new drive, to a minimum of 1. It decreases while the NAND erase cycles increase from 0 to the maximum-rated cycles.",
	},
	234: {
		ID:          234,
		DisplayName: "Average erase count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Decoded as: byte 0-1-2 = average erase count (big endian) and byte 3-4-5 = max erase count (big endian).",
	},
	235: {
		ID:          235,
		DisplayName: "Good Block Count",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Decoded as: byte 0-1-2 = good block count (big endian) and byte 3-4 = system (free) block count.",
	},
	240: {
		ID:          240,
		DisplayName: "Head Flying Hours",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Time spent during the positioning of the drive heads.[15][71] Some Fujitsu drives report the count of link resets during a data transfer.",
	},
	241: {
		ID:          241,
		DisplayName: "Total LBAs Written",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Total count of LBAs written.",
	},
	242: {
		ID:          242,
		DisplayName: "Total LBAs Read",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Total count of LBAs read.Some S.M.A.R.T. utilities will report a negative number for the raw value since in reality it has 48 bits rather than 32.",
	},
	243: {
		ID:          243,
		DisplayName: "Total LBAs Written Expanded",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "The upper 5 bytes of the 12-byte total number of LBAs written to the device. The lower 7 byte value is located at attribute 0xF1.",
	},
	244: {
		ID:          244,
		DisplayName: "Total LBAs Read Expanded",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "The upper 5 bytes of the 12-byte total number of LBAs read from the device. The lower 7 byte value is located at attribute 0xF2.",
	},
	249: {
		ID:          249,
		DisplayName: "NAND Writes (1GiB)",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "Total NAND Writes. Raw value reports the number of writes to NAND in 1 GB increments.",
	},
	250: {
		ID:          250,
		DisplayName: "Read Error Retry Rate",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of errors while reading from a disk.",
	},
	251: {
		ID:          251,
		DisplayName: "Minimum Spares Remaining",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "The Minimum Spares Remaining attribute indicates the number of remaining spare blocks as a percentage of the total number of spare blocks available.",
	},
	252: {
		ID:          252,
		DisplayName: "Newly Added Bad Flash Block",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       "",
		Critical:    false,
		Description: "The Newly Added Bad Flash Block attribute indicates the total number of bad flash blocks the drive detected since it was first initialized in manufacturing.",
	},
	254: {
		ID:          254,
		DisplayName: "Free Fall Protection",
		DisplayType: AtaSmartAttributeDisplayTypeNormalized,
		Ideal:       ObservedThresholdIdealLow,
		Critical:    false,
		Description: "Count of \"Free Fall Events\" detected.",
	},
}
