import { Type } from "@google/genai";

// Schema for commit message responses
export const commitMessageSchema = {
  type: Type.OBJECT,
  properties: {
    type: {
      type: Type.STRING,
      enum: ["feat", "fix", "docs", "style", "refactor", "test", "chore", "perf", "ci"],
    },
    scope: {
      type: Type.STRING,
      nullable: true,
    },
    emoji: {
      type: Type.STRING,
      nullable: true,
    },
    subject: {
      type: Type.STRING,
    },
    body: {
      type: Type.STRING,
      nullable: true,
    },
  },
  required: ["type", "subject"],
};

// Schema for code review responses
export const reviewSchema = {
  type: Type.OBJECT,
  properties: {
    summary: {
      type: Type.STRING,
    },
    issues: {
      type: Type.ARRAY,
      items: {
        type: Type.OBJECT,
        properties: {
          severity: {
            type: Type.STRING,
            enum: ["error", "warning", "info"],
          },
          file: {
            type: Type.STRING,
            nullable: true,
          },
          line: {
            type: Type.NUMBER,
            nullable: true,
          },
          message: {
            type: Type.STRING,
          },
          suggestion: {
            type: Type.STRING,
            nullable: true,
          },
        },
        required: ["severity", "message"],
      },
    },
    score: {
      type: Type.NUMBER,
      nullable: true,
    },
    recommendations: {
      type: Type.ARRAY,
      items: {
        type: Type.STRING,
      },
      nullable: true,
    },
    positives: {
      type: Type.ARRAY,
      items: {
        type: Type.STRING,
      },
      nullable: true,
    },
  },
  required: ["summary", "issues"],
};