<!-- company-profile.component.html -->
<div class="company-profile-container">
  <div class="profile-header">
    <h2>企业资料</h2>
    <button class="edit-button" (click)="toggleEdit()">
      {{ isEditing ? '保存更改' : '编辑资料' }}
    </button>
  </div>

  <div class="company-info">
    <div class="info-row">
      <label>企业名称</label>
      <span *ngIf="!isEditing">{{ company.name }}</span>
      <input *ngIf="isEditing" [(ngModel)]="company.name">
    </div>

    <div class="info-row">
      <label>企业地址</label>
      <span *ngIf="!isEditing">{{ company.address }}</span>
      <input *ngIf="isEditing" [(ngModel)]="company.address">
    </div>

    <div class="info-row">
      <label>行业方向</label>
      <span *ngIf="!isEditing">{{ company.industry }}</span>
      <input *ngIf="isEditing" [(ngModel)]="company.industry">
    </div>

    <div class="info-row">
      <label>企业简介</label>
      <span *ngIf="!isEditing">{{ company.description }}</span>
      <textarea *ngIf="isEditing" [(ngModel)]="company.description" rows="4"></textarea>
    </div>
  </div>

  <div class="job-openings">
    <h3>招聘职位</h3>
    
    <div *ngIf="isEditing" class="add-job-form">
      <div class="form-row">
        <input [(ngModel)]="newJob.title" placeholder="职位名称">
        <input [(ngModel)]="newJob.requirements" placeholder="职位要求">
      </div>
      <textarea [(ngModel)]="newJob.description" placeholder="职位描述" rows="3"></textarea>
      <button class="add-button" (click)="addJob()">添加职位</button>
    </div>

    <div class="job-list">
      <div *ngFor="let job of company.jobOpenings; let i = index" class="job-card">
        <div class="job-header">
          <h4>{{ job.title }}</h4>
          <button *ngIf="isEditing" class="remove-button" (click)="removeJob(i)">删除</button>
        </div>
        <div class="job-requirements">
          <strong>要求:</strong> {{ job.requirements || '无特定要求' }}
        </div>
        <div class="job-description">
          {{ job.description }}
        </div>
      </div>
    </div>
  </div>
</div>
