package net.micode.myapplication.model;

import java.util.ArrayList;
import java.util.List;

public class Chapter {
    private String chapterId;
    private String courseId;
    private int chapterNumber;
    private String chapterTitle;
    private List<String> keywords;
    private List<String> aliases;

    public Chapter() {
        this.keywords = new ArrayList<>();
        this.aliases = new ArrayList<>();
    }

    public Chapter(String chapterId, String courseId, int chapterNumber, String chapterTitle) {
        this.chapterId = chapterId;
        this.courseId = courseId;
        this.chapterNumber = chapterNumber;
        this.chapterTitle = chapterTitle;
        this.keywords = new ArrayList<>();
        this.aliases = new ArrayList<>();
    }

    public String getChapterId() {
        return chapterId;
    }

    public void setChapterId(String chapterId) {
        this.chapterId = chapterId;
    }

    public String getCourseId() {
        return courseId;
    }

    public void setCourseId(String courseId) {
        this.courseId = courseId;
    }

    public int getChapterNumber() {
        return chapterNumber;
    }

    public void setChapterNumber(int chapterNumber) {
        this.chapterNumber = chapterNumber;
    }

    public String getChapterTitle() {
        return chapterTitle;
    }

    public void setChapterTitle(String chapterTitle) {
        this.chapterTitle = chapterTitle;
    }

    public List<String> getKeywords() {
        return keywords;
    }

    public void setKeywords(List<String> keywords) {
        this.keywords = keywords;
    }

    public List<String> getAliases() {
        return aliases;
    }

    public void setAliases(List<String> aliases) {
        this.aliases = aliases;
    }

    public void addKeyword(String keyword) {
        if (this.keywords == null) {
            this.keywords = new ArrayList<>();
        }
        this.keywords.add(keyword);
    }

    public void addAlias(String alias) {
        if (this.aliases == null) {
            this.aliases = new ArrayList<>();
        }
        this.aliases.add(alias);
    }

    @Override
    public String toString() {
        return "Chapter{" +
                "chapterId='" + chapterId + '\'' +
                ", courseId='" + courseId + '\'' +
                ", chapterNumber=" + chapterNumber +
                ", chapterTitle='" + chapterTitle + '\'' +
                ", keywords=" + keywords +
                ", aliases=" + aliases +
                '}';
    }
}