<commit_before>
const { formatDate } = require("./common.js")

function ADR(id,title,status,context,decision,consequences)
{
  this.id = id
  this.title = title
  this.states = []
  this.states.push(status)
  this.context = context
  this.decision = decision
  this.consequences = consequences

  this.toADRString = () => {
    return `# ${this.id} ${this.title}

## Status

${this.states.join("\n")}

## Context
${this.context}

## Decision
${this.decision}

## Consequences
${this.consequences}

    `
  }

  return this;
}


let STATUS_PROPOSED = (d) => {
  let dt = d || (new Date())
  return `Proposed ${formatDate(dt)}`
}




let createADR = (_id,_title,_status, _context,_decision,_cons) => {
  if (!_id) throw new Error("No ID given for new ADR")
  if (!_title) throw new Error("No title given for new ADR")
  let st = _status || STATUS_PROPOSED()
  let ctx = _context || ""
  let dec = _decision || ""
  let cons = _cons || ""

  return new ADR(_id,_title,st,ctx,dec,cons)
}

module.exports = {
  create : createADR
}
<commit_msg>WIP: starting to implement accept method for ADR obj.<commit_after>
const { formatDate } = require("./common.js")

function ADR(id,title,status,context,decision,consequences)
{
  this.id = id
  this.title = title
  this.states = []
  this.states.push(status)
  this.context = context
  this.decision = decision
  this.consequences = consequences

  this.accept = (dt) => this.states.push(STATUS_ACCEPTED(date))

  this.toADRString = () => {
    return `# ${this.id} ${this.title}

## Status

${this.states.join("\n")}

## Context
${this.context}

## Decision
${this.decision}

## Consequences
${this.consequences}

    `
  }

  return this;
}

let STATUS_ACCEPTED = (d) => {
  let date = dt || (new Date())
  return `Accepted ${formatDate(date)}`
}
let STATUS_PROPOSED = (d) => {
  let dt = d || (new Date())
  return `Proposed ${formatDate(dt)}`
}


let acceptADR = (dt) => {
  let date = dt || (new Date())

}

let createADR = (_id,_title,_status, _context,_decision,_cons) => {
  if (!_id) throw new Error("No ID given for new ADR")
  if (!_title) throw new Error("No title given for new ADR")
  let st = _status || STATUS_PROPOSED()
  let ctx = _context || ""
  let dec = _decision || ""
  let cons = _cons || ""

  return new ADR(_id,_title,st,ctx,dec,cons)
}

let fromRawContent = (raw) => {
  let statusRE = /Status[\s]*$[\s]+([\w\- \n]+)/gm

}

module.exports = {
  create : createADR
  // , parse : fromRawContent
}

{'fraction_non_alphanumeric': 0.1700487012987013, 'fraction_numerical': 0.0, 'mean_word_length': 3.650943396226415, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '455805', 'n_tokens_mistral': 917, 'n_tokens_neox': 881, 'n_words': 211}