{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rs.herehigher.com/schema/resume-studio-web-v4.schema.json",
  "title": "Resume Studio web v4 export",
  "description": "The JSON backup format exported by Resume Studio. Resume data must not be uploaded, transmitted, or shared without the user's explicit authorization. The required x-resume-studio-uniqueBy applicator rejects duplicate stable record IDs.",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "settings", "profile", "documents"],
  "properties": {
    "version": { "const": 4 },
    "settings": {
      "type": "object",
      "required": ["locale", "pageSizeByLocale", "pageBreaks"],
      "properties": {
        "locale": { "enum": ["ja", "zh-CN", "en"] },
        "pageSizeByLocale": {
          "type": "object", "additionalProperties": false,
          "required": ["ja", "zh-CN", "en"],
          "properties": {
            "ja": { "enum": ["A4", "LETTER"] },
            "zh-CN": { "enum": ["A4", "LETTER"] },
            "en": { "enum": ["A4", "LETTER"] }
          }
        },
        "pageBreaks": {
          "type": "object", "additionalProperties": false,
          "required": ["ja", "zh-CN", "en"],
          "properties": {
            "ja": { "$ref": "#/$defs/japanesePageBreaks" },
            "zh-CN": { "$ref": "#/$defs/internationalPageBreaks" },
            "en": { "$ref": "#/$defs/internationalPageBreaks" }
          }
        }
      }
    },
    "profile": {
      "type": "object",
      "required": ["photo", "fields"],
      "properties": {
        "photo": {
          "type": "string",
          "pattern": "^(?:$|[dD][aA][tT][aA]:[iI][mM][aA][gG][eE]/(?:[jJ][pP][eE][gG]|[pP][nN][gG]|[wW][eE][bB][pP]);[bB][aA][sS][eE]64,)"
        },
        "fields": { "$ref": "#/$defs/profileFields" }
      }
    },
    "documents": {
      "type": "object",
      "required": ["ja", "zh-CN", "en"],
      "properties": {
        "ja": { "$ref": "#/$defs/japaneseDocument" },
        "zh-CN": { "$ref": "#/$defs/chineseDocument" },
        "en": { "$ref": "#/$defs/englishDocument" }
      }
    }
  },
  "$defs": {
    "recordId": { "type": "string", "pattern": "^record_[A-Za-z0-9_-]+(?:-[A-Za-z0-9_-]+)*$" },
    "japaneseResumeBreakTargets": { "type": "array", "uniqueItems": true, "maxItems": 4, "items": { "enum": ["history", "qualifications", "motivation", "requests"] } },
    "japaneseCareerBreakTargets": { "type": "array", "uniqueItems": true, "maxItems": 4, "items": { "enum": ["summary", "skills", "career-history", "self-promotion"] } },
    "internationalBreakTargets": { "type": "array", "uniqueItems": true, "maxItems": 6, "items": { "enum": ["summary", "experience", "projects", "education", "skills", "certifications"] } },
    "recordBreakTargets": { "type": "array", "uniqueItems": true, "items": { "$ref": "#/$defs/recordId" } },
    "japaneseResumeBreakSettings": { "type": "object", "additionalProperties": false, "required": ["sections", "records"], "properties": { "sections": { "$ref": "#/$defs/japaneseResumeBreakTargets" }, "records": { "$ref": "#/$defs/recordBreakTargets" } } },
    "japaneseCareerBreakSettings": { "type": "object", "additionalProperties": false, "required": ["sections", "records"], "properties": { "sections": { "$ref": "#/$defs/japaneseCareerBreakTargets" }, "records": { "$ref": "#/$defs/recordBreakTargets" } } },
    "internationalBreakSettings": { "type": "object", "additionalProperties": false, "required": ["sections", "records"], "properties": { "sections": { "$ref": "#/$defs/internationalBreakTargets" }, "records": { "$ref": "#/$defs/recordBreakTargets" } } },
    "japanesePageBreaks": {
      "type": "object", "additionalProperties": false, "required": ["A4", "LETTER"],
      "properties": {
        "A4": { "$ref": "#/$defs/japanesePageBreakDocuments" },
        "LETTER": { "$ref": "#/$defs/japanesePageBreakDocuments" }
      }
    },
    "japanesePageBreakDocuments": {
      "type": "object", "additionalProperties": false, "required": ["resume", "career"],
      "properties": { "resume": { "$ref": "#/$defs/japaneseResumeBreakSettings" }, "career": { "$ref": "#/$defs/japaneseCareerBreakSettings" } }
    },
    "internationalPageBreaks": {
      "type": "object", "additionalProperties": false, "required": ["A4", "LETTER"],
      "properties": {
        "A4": { "$ref": "#/$defs/internationalPageBreakDocuments" },
        "LETTER": { "$ref": "#/$defs/internationalPageBreakDocuments" }
      }
    },
    "internationalPageBreakDocuments": {
      "type": "object", "additionalProperties": false, "required": ["resume"],
      "properties": { "resume": { "$ref": "#/$defs/internationalBreakSettings" } }
    },
    "string": { "type": "string" },
    "profileFields": {
      "type": "object",
      "required": ["fullName", "birthDate", "gender", "nationality", "postalCode", "address", "phone", "email", "links"],
      "properties": {
        "fullName": { "$ref": "#/$defs/string" },
        "birthDate": { "$ref": "#/$defs/string" },
        "gender": { "enum": ["", "male", "female", "other"] },
        "nationality": { "$ref": "#/$defs/string" },
        "postalCode": { "$ref": "#/$defs/string" },
        "address": { "$ref": "#/$defs/string" },
        "phone": { "$ref": "#/$defs/string" },
        "email": { "$ref": "#/$defs/string" },
        "links": { "type": "array", "maxItems": 3, "items": { "$ref": "#/$defs/string" } }
      }
    },
    "japaneseDocument": {
      "type": "object",
      "required": ["activeDocument", "fields", "education", "employment", "qualification", "careers"],
      "properties": {
        "activeDocument": { "enum": ["resume", "career"] },
        "fields": {
          "type": "object",
          "required": ["nameKana", "addressKana", "createdDate", "motivation", "requests", "careerSummary", "skills", "selfPromotion"],
          "properties": {
            "nameKana": { "$ref": "#/$defs/string" }, "addressKana": { "$ref": "#/$defs/string" }, "createdDate": { "$ref": "#/$defs/string" }, "motivation": { "$ref": "#/$defs/string" },
            "requests": { "$ref": "#/$defs/string" }, "careerSummary": { "$ref": "#/$defs/string" }, "skills": { "$ref": "#/$defs/string" }, "selfPromotion": { "$ref": "#/$defs/string" },
            "residenceStatus": { "$ref": "#/$defs/string" },
            "workRestriction": { "enum": ["", "none", "restricted"] },
            "residenceExpiryDate": {
              "anyOf": [
                { "const": "" },
                { "type": "string", "format": "date" }
              ]
            }
          }
        },
        "education": { "type": "array", "items": { "$ref": "#/$defs/japaneseLine" } },
        "employment": { "type": "array", "items": { "$ref": "#/$defs/japaneseLine" } },
        "qualification": { "type": "array", "items": { "$ref": "#/$defs/qualification" } },
        "careers": { "type": "array", "x-resume-studio-uniqueBy": "id", "items": { "$ref": "#/$defs/japaneseCareer" } }
      }
    },
    "japaneseLine": {
      "type": "object",
      "required": ["date", "detail"],
      "properties": { "date": { "$ref": "#/$defs/string" }, "detail": { "$ref": "#/$defs/string" } }
    },
    "qualification": {
      "type": "object",
      "required": ["date", "detail", "url"],
      "properties": { "date": { "$ref": "#/$defs/string" }, "detail": { "$ref": "#/$defs/string" }, "url": { "$ref": "#/$defs/string" } }
    },
    "japaneseCareer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "company", "role", "startDate", "endDate", "companyInfo", "detailSections"],
      "properties": {
        "id": { "$ref": "#/$defs/recordId" },
        "company": { "$ref": "#/$defs/string" }, "role": { "$ref": "#/$defs/string" }, "startDate": { "$ref": "#/$defs/string" }, "endDate": { "$ref": "#/$defs/string" },
        "companyInfo": { "$ref": "#/$defs/string" },
        "detailSections": { "type": "array", "items": { "$ref": "#/$defs/japaneseCareerDetailSection" } }
      }
    },
    "japaneseCareerDetailSection": {
      "type": "object",
      "additionalProperties": false,
      "required": ["title", "content"],
      "properties": { "title": { "$ref": "#/$defs/string" }, "content": { "$ref": "#/$defs/string" } }
    },
    "chineseDocument": {
      "type": "object",
      "required": ["activeDocument", "resume"],
      "properties": {
        "activeDocument": { "const": "resume" },
        "resume": {
          "type": "object",
          "required": ["headline", "summary", "education", "experience", "projects", "skills", "certifications"],
          "properties": {
            "headline": { "$ref": "#/$defs/string" }, "summary": { "$ref": "#/$defs/string" }, "skills": { "$ref": "#/$defs/string" },
            "education": { "type": "array", "items": { "$ref": "#/$defs/education" } },
            "experience": { "type": "array", "x-resume-studio-uniqueBy": "id", "items": { "$ref": "#/$defs/experience" } },
            "projects": { "type": "array", "items": { "$ref": "#/$defs/project" } },
            "certifications": { "type": "array", "items": { "$ref": "#/$defs/certification" } }
          }
        }
      }
    },
    "englishDocument": {
      "type": "object",
      "required": ["activeDocument", "resume"],
      "properties": {
        "activeDocument": { "const": "resume" },
        "resume": {
          "type": "object",
          "required": ["showOptionalPersonalDetails", "headline", "location", "summary", "education", "experience", "projects", "skills", "certifications"],
          "properties": {
            "showOptionalPersonalDetails": { "type": "boolean" }, "headline": { "$ref": "#/$defs/string" }, "location": { "$ref": "#/$defs/string" }, "summary": { "$ref": "#/$defs/string" }, "skills": { "$ref": "#/$defs/string" },
            "education": { "type": "array", "items": { "$ref": "#/$defs/education" } },
            "experience": { "type": "array", "x-resume-studio-uniqueBy": "id", "items": { "$ref": "#/$defs/experience" } },
            "projects": { "type": "array", "items": { "$ref": "#/$defs/project" } },
            "certifications": { "type": "array", "items": { "$ref": "#/$defs/certification" } }
          }
        }
      }
    },
    "education": {
      "type": "object",
      "required": ["startDate", "endDate", "school", "degree", "details"],
      "properties": { "startDate": { "$ref": "#/$defs/string" }, "endDate": { "$ref": "#/$defs/string" }, "school": { "$ref": "#/$defs/string" }, "degree": { "$ref": "#/$defs/string" }, "details": { "$ref": "#/$defs/string" } }
    },
    "experience": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "startDate", "endDate", "company", "role", "details"],
      "properties": { "id": { "$ref": "#/$defs/recordId" }, "startDate": { "$ref": "#/$defs/string" }, "endDate": { "$ref": "#/$defs/string" }, "company": { "$ref": "#/$defs/string" }, "role": { "$ref": "#/$defs/string" }, "details": { "$ref": "#/$defs/string" } }
    },
    "project": {
      "type": "object",
      "required": ["startDate", "endDate", "name", "role", "details", "url"],
      "properties": { "startDate": { "$ref": "#/$defs/string" }, "endDate": { "$ref": "#/$defs/string" }, "name": { "$ref": "#/$defs/string" }, "role": { "$ref": "#/$defs/string" }, "details": { "$ref": "#/$defs/string" }, "url": { "$ref": "#/$defs/string" } }
    },
    "certification": {
      "type": "object",
      "required": ["date", "name", "url"],
      "properties": { "date": { "$ref": "#/$defs/string" }, "name": { "$ref": "#/$defs/string" }, "url": { "$ref": "#/$defs/string" } }
    }
  }
}
